Skip to contentSkip to conversation

tsearch.3: Use size_t for malloc() argument

PATCH In review Alejandro Colomar 2 participants 2 messages Sep 5, 2020 Man-pages: manual pages for Linux -- Sections 2, 3, 4, 5, and 7

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tsearch.3: Use size_t for malloc() argument

---
 man3/tsearch.3 | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
man3/tsearch.3 +2 -1
index f0ff80e8c..32ddb8127 100644
@@ -271,6 +271,7 @@ in order.
 .EX
 #define _GNU_SOURCE     /* Expose declaration of tdestroy() */
 #include <search.h>
+#include <stddef.h>
 #include <stdlib.h>
 #include <stdio.h>
 #include <time.h>
@@ -278,7 +279,7 @@ in order.
 static void *root = NULL;
 
 static void *
-xmalloc(unsigned n)
+xmalloc(size_t n)
 {
     void *p;
     p = malloc(n);
Signature · 1 line
2.28.0
#1 lore raw
Quoted 4 lines · Alejandro Colomar
---
 man3/tsearch.3 | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Thanks, Alex. Patch applied?

Cheers,

Michael

Quoted 22 lines
man3/tsearch.3 +2 -1
index f0ff80e8c..32ddb8127 100644
@@ -271,6 +271,7 @@ in order.
 .EX
 #define _GNU_SOURCE     /* Expose declaration of tdestroy() */
 #include <search.h>
+#include <stddef.h>
 #include <stdlib.h>
 #include <stdio.h>
 #include <time.h>
@@ -278,7 +279,7 @@ in order.
 static void *root = NULL;
 
 static void *
-xmalloc(unsigned n)
+xmalloc(size_t n)
 {
     void *p;
     p = malloc(n);
Signature · 3 lines
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/