• R/O
  • SSH

libctools: Commit

This library contains code that extends and simplifies different operations
for C language based programs.


Commit MetaInfo

Revisión25558ea24a6c64d040cdb51b0693b3eaad56e98b (tree)
Tiempo2022-10-05 12:27:46
AutorSergey Gusarov <laborer2008@gmai...>
CommiterSergey Gusarov

Log Message

Using of strNDupWrapper() instead of strndup()

Cambiar Resumen

Diferencia incremental

diff -r d8bcf99ba262 -r 25558ea24a6c src/os/io.c
--- a/src/os/io.c Wed Oct 05 06:15:28 2022 +0300
+++ b/src/os/io.c Wed Oct 05 06:27:46 2022 +0300
@@ -178,7 +178,7 @@
178178 char* pathCopy;
179179
180180 if (CT_LIKELY(path))
181- pathCopy = strndup(path, kPathLimit);
181+ pathCopy = strNDupWrapper(path, kPathLimit);
182182 else
183183 pathCopy = CT_NULL;
184184
diff -r d8bcf99ba262 -r 25558ea24a6c src/os/stack_trace/demangle.c
--- a/src/os/stack_trace/demangle.c Wed Oct 05 06:15:28 2022 +0300
+++ b/src/os/stack_trace/demangle.c Wed Oct 05 06:27:46 2022 +0300
@@ -66,7 +66,7 @@
6666 if (buffer[0])
6767 {
6868 // We have here some symbol
69- demangledName = strndup(buffer, CT_DEMANGLED_NAME_MAXIMUM_LENGTH);
69+ demangledName = strNDupWrapper(buffer, CT_DEMANGLED_NAME_MAXIMUM_LENGTH);
7070 break;
7171 }
7272 }
@@ -74,14 +74,14 @@
7474 // If that didn't work, try to get a regular c symbol
7575 sscanfReturn = sscanf(functionName, "%" CT_STRINGIFY(CT_DEMANGLED_NAME_MAXIMUM_LENGTH) "s", buffer);
7676 if ((sizeof(char) == sscanfReturn) && buffer[0])
77- demangledName = strndup(buffer, CT_DEMANGLED_NAME_MAXIMUM_LENGTH);
77+ demangledName = strNDupWrapper(buffer, CT_DEMANGLED_NAME_MAXIMUM_LENGTH);
7878 else
79- demangledName = strndup(functionName, CT_DEMANGLED_NAME_MAXIMUM_LENGTH);
79+ demangledName = strNDupWrapper(functionName, CT_DEMANGLED_NAME_MAXIMUM_LENGTH);
8080 }
8181 while(CT_FALSE);
8282
8383 # else // defined CT_LIBC_MSVCRT
84- demangledName = strndup(functionName, CT_DEMANGLED_NAME_MAXIMUM_LENGTH);
84+ demangledName = strNDupWrapper(functionName, CT_DEMANGLED_NAME_MAXIMUM_LENGTH);
8585 # endif
8686
8787 CT_CHECK_PTR(demangledName);
Show on old repository browser