torrentd

simple torrent daemon
git clone git@git.2f30.org/torrentd.git
Log | Files | Refs | LICENSE

commit 9309cc553bcbeea4432c7609175dc5960deae133
parent 3bbc9320e8c90fafe2f60e7fe9dc2cb967a5f0b0
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date:   Fri, 18 Dec 2015 21:06:30 +0100

use len for lists and dictionaries too

Diffstat:
Mben.c | 3+++
1 file changed, 3 insertions(+), 0 deletions(-)

diff --git a/ben.c b/ben.c @@ -108,6 +108,7 @@ parsedl(char *s, char *e, struct ben **b) struct ben head; struct ben *bp = &head; int type = *p; + long long int len = 0; memset(&head, 0, sizeof(head)); if (*p != 'd' && *p != 'l') @@ -117,6 +118,7 @@ parsedl(char *s, char *e, struct ben **b) error("bad dictionary or list"); if (*p == 'e') break; + len++; bp->next = emalloc(sizeof(*bp)); bp = bp->next; bp->type = type; @@ -139,6 +141,7 @@ parsedl(char *s, char *e, struct ben **b) (*b)->v = NULL; (*b)->next = NULL; } + (*b)->len = len; (*b)->start = s; (*b)->end = p + 1; return p;