On Monday, March 11, 2013 21:39:49 Linus Nielsen Feltzing wrote:
> +/* Combine hostname and local IP address to create a keystring for hashing */
> +static char *create_hash_key(struct connectdata *conn)
> +{
> +  size_t iplen = strlen(conn->local_ip);
> +  size_t hostlen = strlen(conn->host.name);
> +  char *key = malloc(hostlen + iplen + 1);
> +
> +  if(!key)
> +    return NULL;
> +
> +  strcpy(key, conn->local_ip);
> +  strcpy(key + iplen, conn->host.name);
> +  return key;
> +}

Please consider replacing the open-coded string concatenation above by:

    return aprintf("%s%s", conn->local_ip, conn->host.name);

Kamil
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html

Reply via email to