diff options
| author | zouziyu2002 <[email protected]> | 2023-04-28 22:55:28 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2023-04-28 15:55:28 +0100 |
| commit | ce4674defa042fcc87cc1b54b739f81edae7d797 (patch) | |
| tree | cc2799948c32af514ed88d2ed0fcacc71ef58cb7 /examples/libc/ex4.c | |
| parent | 085ded8eef541ee8b347468c42c359d580fcd127 (diff) | |
[HUST CSE] add forced type conversion when using 'realloc','malloc','calloc' for better readability
Diffstat (limited to 'examples/libc/ex4.c')
| -rw-r--r-- | examples/libc/ex4.c | 2 |
1 files changed, 1 insertions, 1 deletions
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. */ |
