Logo Search packages:      
Sourcecode: libnl2 version File versions  Download package

int nl_data_append ( struct nl_data *  data,
void *  buf,
size_t  size 
)

Append data to an abstract data object.

  • data Abstract data object.
  • buf Data buffer containing the data to be appended.
  • size Size of data to be apppended.
Reallocates an abstract data and copies the specified data buffer into the new handle.

Returns:
0 on success or a negative error code

Definition at line 99 of file data.c.

Referenced by rtnl_u32_add_key().

{
      if (size < 0)
            BUG();

      if (size > 0) {
            data->d_data = realloc(data->d_data, data->d_size + size);
            if (!data->d_data)
                  return -NLE_NOMEM;

            if (buf)
                  memcpy(data->d_data + data->d_size, buf, size);
            else
                  memset(data->d_data + data->d_size, 0, size);

            data->d_size += size;
      }

      return 0;
}


Generated by  Doxygen 1.6.0   Back to index