anchao commented on code in PR #15326: URL: https://github.com/apache/nuttx/pull/15326#discussion_r1896728137
########## libs/libc/misc/lib_tempbuffer.c: ########## @@ -63,58 +63,61 @@ static struct pathbuffer_s g_pathbuffer = ****************************************************************************/ /**************************************************************************** - * Name: lib_get_pathbuffer + * Name: lib_get_tempbuffer * * Description: - * The lib_get_pathbuffer() function returns a pointer to a temporary + * The lib_get_tempbuffer() function returns a pointer to a temporary * buffer. The buffer is allocated from a pool of pre-allocated buffers * and if the pool is exhausted, a new buffer is allocated through - * kmm_malloc(). The size of the buffer is PATH_MAX, and must freed by - * calling lib_put_pathbuffer(). + * kmm_malloc(). The size of the buffer is nbytes, and must freed by + * calling lib_put_tempbuffer(). * * Returned Value: - * On success, lib_get_pathbuffer() returns a pointer to a temporary + * On success, lib_get_tempbuffer() returns a pointer to a temporary * buffer. On failure, NULL is returned. * ****************************************************************************/ -FAR char *lib_get_pathbuffer(void) +FAR char *lib_get_tempbuffer(size_t nbytes) { - for (; ; ) + if (nbytes <= TEMP_MAX_SIZE) Review Comment: I don't understand this change. If the required path buffer size is large than PATH_MAX, why not just call malloc() in application? Why must use this API? I haven't seen lib_get_pathbuffer() used anywhere else except the kernel, 100% of the source code is using PATH_MAX, why add this redundant check? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org