Logo Search packages:      
Sourcecode: dballe version File versions

dba_err dba_record_add ( dba_record  dest,
dba_record  source 

Copy all data from the record source into dest. At the end of the function, dest will contain its previous values, plus the values in source. If a value is present both in source and in dest, the one in dest will be overwritten.

dest The record to copy data into.
source The record to copy data from.
The error indicator for the function.

Definition at line 266 of file dba_record.c.


      int i;

      /* Copy the keyword table first */
      for (i = 0; i < KEYWORD_TABLE_SIZE; i++)
            if (source->keydata[i] != NULL)
                  if (dest->keydata[i] != NULL)
                  DBA_RUN_OR_RETURN(dba_var_copy(source->keydata[i], &(dest->keydata[i])));

      /* Then the variables list */
      if (source->vars)
            dba_item* t = &(dest->vars);
            dba_item c;
            for ( ; (*t) != NULL; t = &((*t)->next))
            for (c = source->vars; c != NULL; c = c->next)
                  (*t) = (dba_item)calloc(1, sizeof(struct _dba_item));
                  if ((*t) == NULL)
                        return dba_error_alloc("creating new dba_item");

                  DBA_RUN_OR_RETURN(dba_var_copy(c->var, &((*t)->var)));

                  t = &((*t)->next);
      return dba_error_ok();

Generated by  Doxygen 1.6.0   Back to index