Changeset - 5bee5e566377
[Not reviewed]
default
0 2 0
Nathan Brink (binki) - 16 years ago 2009-09-13 14:45:41
ohnobinki@ohnopublishing.net
removed remove_job, use distrenjob_remove
2 files changed with 12 insertions and 39 deletions:
0 comments (0 inline, 0 general)
src/server/distrend.c
Show inline comments
 
@@ -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,41 +334,17 @@ 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;
 
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);
 
    }
 
    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;
 
}
 

	
 

	
 

	
 
/**
 
  Frame Finder: matches your computer up with a lovely frame to render
 
@@ -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);
 
}
 

	
 

	
src/server/distrenjob.c
Show inline comments
 
@@ -16,7 +16,6 @@
 
  You should have received a copy of the GNU Affero General Public License
 
  along with DistRen.  If not, see <http://www.gnu.org/licenses/>.
 
*/
 

	
 
#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;
 
}
0 comments (0 inline, 0 general)