Changeset fc7481a


Ignore:
Timestamp:
Feb 4, 2011, 3:49:44 PM (10 years ago)
Author:
David Benjamin <davidben@mit.edu>
Branches:
master, release-1.8, release-1.9
Children:
dfe5829
Parents:
65c753e
git-author:
David Benjamin <davidben@mit.edu> (01/24/11 17:55:19)
git-committer:
David Benjamin <davidben@mit.edu> (02/04/11 15:49:44)
Message:
strndup is pretty awesome and doesn't involve adding 5
File:
1 edited

Legend:

Unmodified
Added
Removed
  • zephyr.c

    r5fca55f rfc7481a  
    480480{
    481481  int i, count, save;
    482   char *out;
    483482
    484483  /* If there's no message here, just run along now */
     
    500499  /* catch the last field, which might not be null terminated */
    501500  if (count==j-1) {
    502     out=owl_malloc(n->z_message_len-save+5);
    503     memcpy(out, n->z_message+save, n->z_message_len-save);
    504     out[n->z_message_len-save]='\0';
    505     return(out);
     501    return g_strndup(n->z_message + save, n->z_message_len - save);
    506502  }
    507503
     
    532528  if (count == j - 1) {
    533529    char *tmp, *out;
    534     tmp = owl_malloc(n->z_message_len-save+5);
    535     memcpy(tmp, n->z_message+save, n->z_message_len-save);
    536     tmp[n->z_message_len-save]='\0';
     530    tmp = g_strndup(n->z_message + save, n->z_message_len - save);
    537531    out = owl_validate_or_convert(tmp);
    538532    owl_free(tmp);
Note: See TracChangeset for help on using the changeset viewer.