~eday/gearmand/fixes

« back to all changes in this revision

Viewing changes to libgearman/worker.c

  • Committer: Eric Day
  • Date: 2009-09-26 16:54:44 UTC
  • Revision ID: eday@oddments.org-20090926165444-g2rbeci54p14gjsh
Removed list add/del macros from libgearman. Moved error_set to gearman.c since first arg is a gearman struct (following OO guidelines).

Show diffs side-by-side

added added

removed removed

Lines of Context:
593
593
  if (job->options & GEARMAN_JOB_WORK_IN_USE)
594
594
    gearman_packet_free(&(job->work));
595
595
 
596
 
  GEARMAN_LIST_DEL(job->worker->job, job,)
 
596
  if (job->worker->job_list == job)
 
597
    job->worker->job_list= job->next;
 
598
  if (job->prev != NULL)
 
599
    job->prev->next= job->next;
 
600
  if (job->next != NULL)
 
601
    job->next->prev= job->prev;
 
602
  job->worker->job_count--;
597
603
 
598
604
  if (job->options & GEARMAN_JOB_ALLOCATED)
599
605
    free(job);
881
887
    return ret;
882
888
  }
883
889
 
884
 
  GEARMAN_LIST_ADD(worker->function, function,)
 
890
  if (worker->function_list != NULL)
 
891
    worker->function_list->prev= function;
 
892
  function->next= worker->function_list;
 
893
  function->prev= NULL;
 
894
  worker->function_list= function;
 
895
  worker->function_count++;
885
896
 
886
897
  worker->options|= GEARMAN_WORKER_CHANGE;
887
898
 
891
902
static void _worker_function_free(gearman_worker_st *worker,
892
903
                                  gearman_worker_function_st *function)
893
904
{
894
 
  GEARMAN_LIST_DEL(worker->function, function,)
 
905
  if (worker->function_list == function)
 
906
    worker->function_list= function->next;
 
907
  if (function->prev != NULL)
 
908
    function->prev->next= function->next;
 
909
  if (function->next != NULL)
 
910
    function->next->prev= function->prev;
 
911
  worker->function_count--;
895
912
 
896
913
  if (function->options & GEARMAN_WORKER_FUNCTION_PACKET_IN_USE)
897
914
    gearman_packet_free(&(function->packet));
918
935
    job->options= 0;
919
936
 
920
937
  job->worker= worker;
921
 
  GEARMAN_LIST_ADD(worker->job, job,)
 
938
 
 
939
  if (worker->job_list != NULL)
 
940
    worker->job_list->prev= job;
 
941
  job->next= worker->job_list;
 
942
  job->prev= NULL;
 
943
  worker->job_list= job;
 
944
  worker->job_count++;
 
945
 
922
946
  job->con= NULL;
923
947
 
924
948
  return job;