int sort_msglist(long listptrs[], int oldcount)
{
int numitems;
+ int i = 0;
numitems = oldcount;
if (numitems < 2) {
qsort(listptrs, numitems, sizeof(long), sort_msglist_cmp);
/* and yank any nulls */
- while ((numitems > 0) && (listptrs[0] == 0L)) {
- memmove(&listptrs[0], &listptrs[1], (sizeof(long) * (numitems - 1)));
- --numitems;
+ while ((i < numitems) && (listptrs[i] == 0L)) i++;
+
+ if (i > 0)
+ {
+ memmove(&listptrs[0], &listptrs[i], (sizeof(long) * (numitems - i)));
+ numitems-=i;
}
return (numitems);
if (strcasecmp(filedir_entry->d_name, "filedir") && filedir_entry->d_name[0] != '.')
{
#ifdef _DIRENT_HAVE_D_NAMELEN
- d_namelen = filedir_entry->d_namelen;
+ d_namelen = filedir_entry->d_namlen;
#else
d_namelen = strlen(filedir_entry->d_name);
#endif