Browse Source

* code cleanup

master
Alex 'AdUser' Z 13 years ago
parent
commit
15d764a80b
  1. 6
      src/torrent2json.c

6
src/torrent2json.c

@ -67,15 +67,15 @@ get_string(int chr)
len *= 10, len += c - '0'; len *= 10, len += c - '0';
/* 'c' now should contain ':' */ /* 'c' now should contain ':' */
if ((buf = malloc(sizeof(char) * len + 1)) == NULL) if ((buf = malloc(sizeof(char) * (len + 1))) == NULL)
{ {
fprintf(stderr, "Can't allocate memory, exiting.\n"); fprintf(stderr, "Can't allocate memory, exiting.\n");
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
memset(buf, '\0', len + 1); memset(buf, '\0', sizeof(char) * (len + 1));
for (i = 0; i < len; i++) for (i = 0; i < len; i++)
*(buf + i * sizeof(char)) = fgetc(in); buf[i] = fgetc(in);
yajl_gen_string(gen, buf, len); yajl_gen_string(gen, buf, len);

Loading…
Cancel
Save