# HG changeset patch # User Binki # Date 2009-09-13 14:45:41 # Node ID 5bee5e5663778037633ae39605aecbb1a9ecec68 # Parent e735102fe86c44ddef6e733222425047a33b402d removed remove_job, use distrenjob_remove diff --git a/src/server/distrend.c b/src/server/distrend.c --- a/src/server/distrend.c +++ b/src/server/distrend.c @@ -72,7 +72,6 @@ struct general_info { */ void status_report_generator(struct distrenjob **distrenjobs_head); void distrenjob_remove(struct distrenjob **head, struct distrenjob *bj); -struct distrenjob *remove_job(int jobnum_t); struct distrenjob *distrenjob_get(struct distrenjob *head, jobnum_t jobnum); struct distrenjob *head; /*@TODO:declare struct with no starting data */ @@ -290,6 +289,7 @@ void status_report_generator(struct dist { distrenjob_ptr->priority = 0; /*< set priority to zero to indicate job is complete */ distrenjob_remove(distrenjobs_head, distrenjob_ptr); /*< remove this job from the linkedlist */ + distrenjob_free(distrenjob_ptr); general_info.total_finished_jobs++; /*< add one to the total finished jobs */ } @@ -314,7 +314,9 @@ void status_report_generator(struct dist } -/** Structure Builder: This function creates frame array based on the total number of frames to be rendered, which will then be parsed by function frame_farmer. */ +/** + Structure Builder: This function creates frame array based on the total number of frames to be rendered, which will then be parsed by function frame_farmer. +*/ void add_job_to_queue(struct distrenjob *job) { struct distrenjob *prev_job = head; // create pointer to previous job struct distrenjob *current_job; // create pointer to current_job (which job is being compared to) @@ -332,42 +334,18 @@ void add_job_to_queue(struct distrenjob } prev_job = current_job; - } // end of for statement -} - -void change_job_priority(int jobnum, int new_priority){ - struct distrenjob *job; - job = remove_job(jobnum); - job->priority = new_priority; - add_job_to_queue(job); + } /* for(current_job) */ } /** - Removes job from queue without freeing/deleting it. Meant to be temporary. + @arg head I may end up changing the head if job == head */ -struct distrenjob *remove_job(int jobnum_t) -{ - struct distrenjob *job; - struct distrenjob *prev_job = head; - - for(job = head; job != NULL; job = job->next){ - if(job == NULL){ - return NULL; - } - if(job->jobnum = jobnum_t){ - prev_job = job->next; - return job; - } - - prev_job = job; - } - - // job was not found if this point is reached - return NULL; +void change_job_priority(struct distrenjob **head, struct distrenjob *job, int new_priority){ + distrenjob_remove(head, job); + job->priority = new_priority; + add_job_to_queue(job); } - - /** Frame Finder: matches your computer up with a lovely frame to render TODO: Major issue here, the client needs to know the frame number, AND the job number! @@ -513,12 +491,6 @@ void distrenjob_remove(struct distrenjob */ previous_distrenjob->next = bj->next; } - - /* - @lordofwar: the magic deallocation of memory ;-) - */ - free(bj->frameset); - free(bj); } diff --git a/src/server/distrenjob.c b/src/server/distrenjob.c --- a/src/server/distrenjob.c +++ b/src/server/distrenjob.c @@ -16,7 +16,6 @@ You should have received a copy of the GNU Affero General Public License along with DistRen. If not, see . */ - #include "distrenjob.h" #include "slavefuncs.h" #include "asprintf.h" @@ -33,6 +32,8 @@ void distrenjob_free(struct distrenjob * xmlFree(dj->submitter); xmlFree(dj->email); + free(dj->frameset); + free(dj); *distrenjob = NULL; }