server/connections.c
/* Accessors for public fields in the connection structure.
 * Everything else is private to this file.
 */
Accessors for public fields in the connection structure.
Everything else is private to this file.
Accessors for public fields in the connection structure . Everything else is private to this file .
int
connection_set_handle (struct connection *conn, size_t i, void *handle)
{
  size_t j;
  if (i < conn->nr_handles)
    conn->handles[i] = handle;
  else {
    j = conn->nr_handles;
    conn->nr_handles = i+1;
    conn->handles = realloc (conn->handles,
                             conn->nr_handles * sizeof (void *));
    if (conn->handles == NULL) {
      perror ("realloc");
      conn->nr_handles = 0;
      return -1;
    }
    for (; j < i; ++j)
      conn->handles[j] = NULL;
    conn->handles[i] = handle;
  }
  return 0;
}
int connection_set_handle ( struct connection * conn , size_t i , void * handle ) { size_t j ; if ( i < conn -> nr_handles ) conn -> handles [ i ] = handle ; else { j = conn -> nr_handles ; conn -> nr_handles = i + 1 ; conn -> handles = realloc ( conn -> handles , conn -> nr_handles * sizeof ( void * ) ) ; if ( conn -> handles == NULL ) { perror ( " " ) ; conn -> nr_handles = 0 ; return -1 ; } for ( ; j < i ; ++ j ) conn -> handles [ j ] = NULL ; conn -> handles [ i ] = handle ; } return 0 ; }
Accessors for public fields in the connection structure.
Accessors for public fields in the connection structure .