diff --git a/libfatstr/libfatstr.c b/libfatstr/libfatstr.c index dc1e58a..453089c 100644 --- a/libfatstr/libfatstr.c +++ b/libfatstr/libfatstr.c @@ -35,10 +35,11 @@ char * FatStr_convert(struct FatStr *p){ char *r; - if((r = malloc(p->s * (sizeof *(p->v)))) == NULL) /* might be buggy */ - return NULL; - strncpy(r, p->v, p->s); - return r; + /* allocation might be wrong */ + return ((r = malloc(p->s * (sizeof *(p->v)))) == NULL) + ? NULL + : strncpy(r, p->v, p->s) + ; } struct FatStr *