Browse Source

Fix #18

Following PR #19
Yann Weber 6 years ago
parent
commit
0c4acf1fba
1 changed files with 1 additions and 5 deletions
  1. 1
    5
      src/ttail_init.c

+ 1
- 5
src/ttail_init.c View File

@@ -342,19 +342,15 @@ error message");
342 342
 
343 343
 int ttail_set_fmt(ttail_t* t, const char* fmt)
344 344
 {
345
-	size_t len;
346 345
 	if(t->flag & TTAIL_FLAG_FORMAT)
347 346
 	{
348 347
 		return -1;
349 348
 	}
350
-	len = strlen(fmt);
351
-	t->fmt = malloc(sizeof(char)*(len+1));
349
+	t->fmt = strdup(fmt);
352 350
 	if(!t->fmt)
353 351
 	{
354 352
 		return -1;
355 353
 	}
356
-	strncpy(t->fmt, fmt, len);
357
-	t->fmt[len] = '\0';
358 354
 	t->flag |= TTAIL_FLAG_FORMAT;
359 355
 	return 0;
360 356
 }

Loading…
Cancel
Save