src/dird/mac_sql.c
static void add_unique_id(idpkt *ids, char *item)
{
   const int maxlen = 30;
   char id[maxlen+1];
   char *q = ids->list;

   /* Walk through current list to see if each item is the same as item */
   for ( ; *q; ) {
       id[0] = 0;
       for (int i=0; i<maxlen; i++) {
          if (*q == 0) {
             break;
          } else if (*q == ',') {
             q++;
             break;
          }
          id[i] = *q++;
          id[i+1] = 0;
       }
       if (strcmp(item, id) == 0) {
          return;
       }
   }
   /* Did not find item, so add it to list */
   if (ids->count == 0) {
      ids->list[0] = 0;
   } else {
      pm_strcat(ids->list, ",");
   }
   pm_strcat(ids->list, item);
   ids->count++;
// Dmsg3(0, "add_uniq count=%d Ids=%p %s\n", ids->count, ids->list, ids->list);
   return;
}
/* Add an item to the list if it is unique */
Add an item to the list if it is unique
Add an item to the list if it is unique
static void add_unique_id(idpkt *ids, char *item)
{
   const int maxlen = 30;
   char id[maxlen+1];
   char *q = ids->list;
   for ( ; *q; ) {
       id[0] = 0;
       for (int i=0; i<maxlen; i++) {
          if (*q == 0) {
             break;
          } else if (*q == ',') {
             q++;
             break;
          }
          id[i] = *q++;
          id[i+1] = 0;
       }
       if (strcmp(item, id) == 0) {
          return;
       }
   }
   if (ids->count == 0) {
      ids->list[0] = 0;
   } else {
      pm_strcat(ids->list, ",");
   }
   pm_strcat(ids->list, item);
   ids->count++;
   return;
}
static void add_unique_id ( idpkt * ids , char * item ) { const int maxlen = 30 ; char id [ maxlen + 1 ] ; char * q = ids -> list ; for ( ; * q ; ) { id [ 0 ] = 0 ; for ( int i = 0 ; i < maxlen ; i ++ ) { if ( * q == 0 ) { break ; } else if ( * q == ' ' ) { q ++ ; break ; } id [ i ] = * q ++ ; id [ i + 1 ] = 0 ; } if ( strcmp ( item , id ) == 0 ) { return ; } } if ( ids -> count == 0 ) { ids -> list [ 0 ] = 0 ; } else { pm_strcat ( ids -> list , " " ) ; } pm_strcat ( ids -> list , item ) ; ids -> count ++ ; return ; }
Add an item to the list if it is unique
Add an item to the list if it is unique
/* Walk through current list to see if each item is the same as item */ /* Did not find item, so add it to list */ // Dmsg3(0, "add_uniq count=%d Ids=%p %s\n", ids->count, ids->list, ids->list);