[Git][cmucl/cmucl][issue-130-file-author-in-c] Revert previous change and use Carl's suggestion.

Raymond Toy pushed to branch issue-130-file-author-in-c at cmucl / cmucl Commits: 10874b35 by Raymond Toy at 2022-10-17T11:34:00-07:00 Revert previous change and use Carl's suggestion. - - - - - 1 changed file: - src/lisp/os-common.c Changes: ===================================== src/lisp/os-common.c ===================================== @@ -730,7 +730,7 @@ os_file_author(const char *path) { struct stat sb; char initial[1024]; - char *buffer, *newbuffer; + char *buffer, *obuffer; size_t size; struct passwd pwd; struct passwd *ppwd; @@ -742,6 +742,7 @@ os_file_author(const char *path) result = NULL; buffer = initial; + obuffer = NULL; size = sizeof(initial) / sizeof(initial[0]); /* @@ -757,11 +758,10 @@ os_file_author(const char *path) case ERANGE: /* Buffer is too small, double its size and try again */ size *= 2; - if ((newbuffer = realloc((buffer == initial) ? NULL : buffer, - size)) == NULL) { + obuffer = (buffer == initial) ? NULL : buffer; + if ((buffer = realloc(obuffer, size)) == NULL) { goto exit; } - buffer = newbuffer; continue; default: /* All other errors */ @@ -769,9 +769,7 @@ os_file_author(const char *path) } } exit: - if (buffer != initial) { - free(buffer); - } + free(obuffer); return result; } View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/commit/10874b356c10e8eca0f5e439... -- View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/commit/10874b356c10e8eca0f5e439... You're receiving this email because of your account on gitlab.common-lisp.net.
participants (1)
-
Raymond Toy (@rtoy)