~ft/nvi

d81d2b35559fea6684cee44a5d4f494fc585e38d — Sigrid Solveig Haflínudóttir 1 year, 10 months ago 785d0c9 front
jstrdup: remove 
1 files changed, 16 insertions(+), 1 deletions(-)

M util.c
M util.c => util.c +16 -1
@@ 191,10 191,25 @@ jfield(JSON *j, int type, ...)
	return (j == nil || (type >= 0 && j->t != type)) ? nil : j;
}

static char *
strclean(char *s)
{
	char *s₀, *o;

	s₀ = s;
	for(o = s; *s; s++){
		if(*s != 0xd)
			*o++ = *s;
	}
	*o = 0;

	return s₀;
}

char *
jstrdup(JSON *j, char *name)
{
	return estrdup(jsonstr(jsonbyname(j, name)));
	return strclean(estrdup(jsonstr(jsonbyname(j, name))));
}

vlong