00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #include <SUM.h>
00016 #include <sum_rpc.h>
00017
00018 void setsumopened(SUMOPENED **list, SUMID_t uid, SUM_t *sum, char *user)
00019 {
00020 SUMOPENED *newone;
00021
00022 newone = (SUMOPENED *)malloc(sizeof(SUMOPENED));
00023 newone->next = *list;
00024 newone->uid = uid;
00025 newone->sum = sum;
00026 strcpy(newone->user, user);
00027 *list = newone;
00028 }
00029
00030 SUMOPENED *getsumopened(SUMOPENED *list, SUMID_t uid)
00031 {
00032 SUMOPENED *walk = list;
00033
00034 while(walk) {
00035 if(walk->uid != uid)
00036 walk = walk->next;
00037 else
00038 return walk;
00039 }
00040 return walk;
00041 }
00042
00043 void remsumopened(SUMOPENED **list, SUMID_t uid)
00044 {
00045 SUMOPENED *walk = *list;
00046 SUMOPENED *trail = NULL;
00047
00048 while(walk) {
00049 if(walk->uid != uid) {
00050 trail = walk;
00051 walk = walk->next;
00052 }
00053 else {
00054 if(trail)
00055 trail->next = walk->next;
00056 else
00057 *list = walk->next;
00058 free(walk);
00059 walk = NULL;
00060 }
00061 }
00062 }