163 |
|
|
164 |
|
if ((idf == NULL) | (param == NULL)) |
165 |
|
return(0); |
166 |
+ |
/* quick check if already there */ |
167 |
+ |
if (param == (prev==NULL ? idf->pfirst : prev->dnext)) |
168 |
+ |
return(1); |
169 |
|
/* find in IDF list, first*/ |
170 |
|
for (plast = NULL, pptr = idf->pfirst; |
171 |
|
pptr != param; plast = pptr, pptr = pptr->dnext) |
172 |
|
if (pptr == NULL) |
173 |
|
return(0); |
174 |
< |
if (plast == NULL) { |
172 |
< |
if (prev == NULL) |
173 |
< |
return(1); /* already in place */ |
174 |
> |
if (plast == NULL) |
175 |
|
idf->pfirst = param->dnext; |
176 |
< |
} else { |
176 |
< |
if (prev == plast) |
177 |
< |
return(1); /* already in place */ |
176 |
> |
else |
177 |
|
plast->dnext = param->dnext; |
179 |
– |
} |
178 |
|
if (idf->plast == param) |
179 |
|
idf->plast = plast; |
180 |
|
if (prev == NULL) { /* means they want it at beginning */ |