Changeset - e735102fe86c
[Not reviewed]
default
0 1 0
Nathan Brink (binki) - 16 years ago 2009-09-13 14:24:39
ohnobinki@ohnopublishing.net
fixed lordofwar's errors and stylistic messups
1 file changed with 18 insertions and 8 deletions:
0 comments (0 inline, 0 general)
src/server/distrend.c
Show inline comments
 
@@ -69,13 +69,13 @@ struct general_info {
 

	
 
/*
 
  internally defined funcs's prototypes
 
*/
 
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 */
 

	
 
/* Global Vars, try to cut down on these */
 
jobnum_t jobnum = 0; // The next job number to create in the queue
 
@@ -157,34 +157,39 @@ void finish_frame(struct distrenjob *dis
 
  distrenjob->frameset[frame].status = 2;
 
  distrenjob->frameset[frame].time_to_render = (clock() - distrenjob[jobnum].frameset[frame].start_time); // Consider changing time-to-render to time-for-frame or something?
 
  general_info.total_frames_rendered++; // Increase total frames var for stats
 
}
 

	
 

	
 
// This function creates a structure from starting data, then calls another function to actually add that struct to the queue
 
void queue(int type, char *name, char *submitter, char *email, int priority, int start_frame, int end_frame){
 
/**
 
   creates a structure from starting data, then calls another function to actually add that struct to the queue
 
*/
 
void queue(int type, char *name, char *submitter, char *email, int priority, int start_frame, int end_frame)
 
{
 
  int counter2;
 
  int counter;
 
  
 
  struct distrenjob *distrenjob;
 

	
 
  distrenjob->type = 1; /*@TODO: add type to blendjob struct*/
 
  distrenjob->name = name;
 
  distrenjob->submitter = submitter;
 
  distrenjob->email = email;
 
  distrenjob->priority = priority;
 
  struct frameset[(end_frame - start_frame + 1)];
 
  distrenjob->frameset = &frameset;
 
  distrenjob->frameset = malloc(end_frame - start_frame + 1);
 
  distrenjob->total_frames = (end_frame - start_frame + 1); // sets the total number of frames in animation for status purposes
 

	
 
  /* @TODO: what does this do? frameset array is declared above */
 
  /*
 
  distrenjob->frameset = malloc(sizeof(struct frameset) * numframes);
 
  if(!job->frameset)
 
    fprintf(stderr, "Error allocating memory\n");
 
  */
 

	
 
  /* prepares all the frames by setting that status to "unassigned" */
 
  int counter2 = start_frame;
 
  int counter;
 
  counter2 = start_frame;
 
  for(counter = 0; counter <= (end_frame- start_frame + 1); counter++){
 
    distrenjob->frameset[counter].num = counter2;
 
    distrenjob->frameset[counter].status = 0;
 

	
 
    counter2++;
 
  }
 
@@ -334,13 +339,17 @@ void change_job_priority(int jobnum, int
 
  struct distrenjob *job;
 
  job = remove_job(jobnum);
 
  job->priority = new_priority;
 
  add_job_to_queue(job);
 
}
 

	
 
distrenjob *remove_job(int jobnum_t){
 
/**
 
   Removes job from queue without freeing/deleting it. Meant to be temporary.
 
 */
 
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;
 
@@ -505,12 +514,13 @@ void distrenjob_remove(struct distrenjob
 
      previous_distrenjob->next = bj->next;
 
    }
 

	
 
  /*
 
     @lordofwar: the magic deallocation of memory ;-)
 
   */
 
  free(bj->frameset);
 
  free(bj);
 
}
 

	
 

	
 
/* Grabs config info from confs */
 
int distrend_do_config(int argc, char *argv[], struct distrend_config **config)
0 comments (0 inline, 0 general)