diff options
author | goodale <goodale@17b73243-c579-4c4c-a9d2-2d5706c11dac> | 2003-02-17 17:41:15 +0000 |
---|---|---|
committer | goodale <goodale@17b73243-c579-4c4c-a9d2-2d5706c11dac> | 2003-02-17 17:41:15 +0000 |
commit | e9a9dd09ca268db0faafbbbf773a0d2af3034f39 (patch) | |
tree | 54a1f79d60e2a69d45db7ba337932c006451536b /src/schedule | |
parent | 08dc979087660675bc153de2dedd93526dd3b786 (diff) |
Added a check against scheduling items with the same name in a schedule bin
or group.
Tom
git-svn-id: http://svn.cactuscode.org/flesh/trunk@3148 17b73243-c579-4c4c-a9d2-2d5706c11dac
Diffstat (limited to 'src/schedule')
-rw-r--r-- | src/schedule/ScheduleCreater.c | 31 |
1 files changed, 20 insertions, 11 deletions
diff --git a/src/schedule/ScheduleCreater.c b/src/schedule/ScheduleCreater.c index 51a186b8..958223f3 100644 --- a/src/schedule/ScheduleCreater.c +++ b/src/schedule/ScheduleCreater.c @@ -577,6 +577,7 @@ static t_sched_item *ScheduleCreateItem(const char *name, t_sched_modifier *modi @returndesc 0 - success -1 - memory failure + -2 - duplicate item @endreturndesc @@*/ static int ScheduleAddItem(int ghandle, t_sched_item *item) @@ -587,27 +588,35 @@ static int ScheduleAddItem(int ghandle, t_sched_item *item) this_group = (t_sched_group *)Util_GetHandledData(schedule_groups, ghandle); - this_group->n_scheditems++; + if(ScheduleItemNumber(this_group, item->name) == -1) + { + this_group->n_scheditems++; - temp = (t_sched_item *)realloc(this_group->scheditems, this_group->n_scheditems*sizeof(t_sched_item)); + temp = (t_sched_item *)realloc(this_group->scheditems, this_group->n_scheditems*sizeof(t_sched_item)); - if(temp) - { - this_group->scheditems = temp; - this_group->scheditems[this_group->n_scheditems-1] = *item; + if(temp) + { + this_group->scheditems = temp; + this_group->scheditems[this_group->n_scheditems-1] = *item; #ifdef DEBUG_SCHEDULAR - printf("Added item '%s' to group '%s'\n", item->name, this_group->name); + printf("Added item '%s' to group '%s'\n", item->name, this_group->name); #endif - free(item); + free(item); - retcode = 0; + retcode = 0; + } + else + { + this_group->n_scheditems--; + retcode = -1; + } } else { - this_group->n_scheditems--; - retcode = -1; + /* Item already existed. */ + retcode = -2; } return retcode; |