From ce4674defa042fcc87cc1b54b739f81edae7d797 Mon Sep 17 00:00:00 2001 From: zouziyu2002 Date: Fri, 28 Apr 2023 22:55:28 +0800 Subject: [HUST CSE] add forced type conversion when using 'realloc','malloc','calloc' for better readability --- examples/libc/ex4.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'examples/libc') diff --git a/examples/libc/ex4.c b/examples/libc/ex4.c index ec1c533a98..df8839c5bc 100644 --- a/examples/libc/ex4.c +++ b/examples/libc/ex4.c @@ -58,7 +58,7 @@ char * str_accumulate(const char * s) accu = (char *) pthread_getspecific(str_key); /* It's initially NULL, meaning that we must allocate the buffer first. */ if (accu == NULL) { - accu = malloc(1024); + accu = (char *)malloc(1024); if (accu == NULL) return NULL; accu[0] = 0; /* Store the buffer pointer in the thread-specific data. */ -- cgit v1.3.1