Zhangshoukui commented on code in PR #15326: URL: https://github.com/apache/nuttx/pull/15326#discussion_r1896733606
########## 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: 1. nbytes <= TEMP_MAX_SIZE: Make sure don't cross the line 2. At present, parameter passing is supported, and the code under the following app uses this interface to optimize the use of the stack. The new feature of nshlib has exceeded the call stack of 2k. -- 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