From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 680 invoked from network); 17 Sep 2021 18:50:52 -0000 Received: from bsd.lv (HELO mandoc.bsd.lv) (66.111.2.12) by inbox.vuxu.org with ESMTPUTF8; 17 Sep 2021 18:50:52 -0000 Received: from fantadrom.bsd.lv (localhost [127.0.0.1]) by mandoc.bsd.lv (OpenSMTPD) with ESMTP id 0b62e2e1 for ; Fri, 17 Sep 2021 13:50:51 -0500 (EST) Received: from localhost (mandoc.bsd.lv [local]) by mandoc.bsd.lv (OpenSMTPD) with ESMTPA id 84a6e20d for ; Fri, 17 Sep 2021 13:50:51 -0500 (EST) Date: Fri, 17 Sep 2021 13:50:51 -0500 (EST) X-Mailinglist: mandoc-source Reply-To: source@mandoc.bsd.lv MIME-Version: 1.0 From: schwarze@mandoc.bsd.lv To: source@mandoc.bsd.lv Subject: mandoc: document mandoc_recallocarray(3); patch found in my tree, X-Mailer: activitymail 1.26, http://search.cpan.org/dist/activitymail/ Content-Type: text/plain; charset=utf-8 Message-ID: Log Message: ----------- document mandoc_recallocarray(3); patch found in my tree, apparently forgotten years ago Modified Files: -------------- mandoc: mandoc_malloc.3 Revision Data ------------- Index: mandoc_malloc.3 =================================================================== RCS file: /home/cvs/mandoc/mandoc/mandoc_malloc.3,v retrieving revision 1.2 retrieving revision 1.3 diff -Lmandoc_malloc.3 -Lmandoc_malloc.3 -u -p -r1.2 -r1.3 --- mandoc_malloc.3 +++ mandoc_malloc.3 @@ -22,6 +22,7 @@ .Nm mandoc_realloc , .Nm mandoc_reallocarray , .Nm mandoc_calloc , +.Nm mandoc_recallocarray , .Nm mandoc_strdup , .Nm mandoc_strndup , .Nm mandoc_asprintf @@ -49,6 +50,13 @@ .Fa "size_t nmemb" .Fa "size_t size" .Fc +.Ft "void *" +.Fo mandoc_recallocarray +.Fa "void *ptr" +.Fa "size_t oldnmemb" +.Fa "size_t nmemb" +.Fa "size_t size" +.Fc .Ft "char *" .Fo mandoc_strdup .Fa "const char *s" @@ -82,12 +90,15 @@ The function .Fn mandoc_malloc allocates one new object, leaving the memory uninitialized. The functions -.Fn mandoc_realloc +.Fn mandoc_realloc , +.Fn mandoc_reallocarray , and -.Fn mandoc_reallocarray +.Fn mandoc_recallocarray change the size of an existing object or array, possibly moving it. When shrinking the size, existing data is truncated; when growing, -the additional memory is not initialized. +only +.Fn mandoc_recallocarray +initializes the new elements to zero. The function .Fn mandoc_calloc allocates a new array, initializing it to zero. @@ -99,6 +110,9 @@ The argument .Fa nmemb is the new number of objects in the array. The argument +.Fa oldnmemb +is the number of objects in the array before the call. +The argument .Fa ptr is a pointer to the existing object or array to be resized; if it is .Dv NULL , @@ -168,9 +182,13 @@ is a widespread extension that first app The function .Fn reallocarray is an extension that first appeared in -.Ox 5.6 . -If it is not provided by the operating system, the mandoc build system -uses a bundled portable implementation. +.Ox 5.6 , +and +.Fn recallocarray +in +.Ox 6.1 . +If these two are not provided by the operating system, +the mandoc build system uses bundled portable implementations. .Sh HISTORY The functions .Fn mandoc_malloc , @@ -181,11 +199,12 @@ and have been available since mandoc 1.9.12, .Fn mandoc_strndup since 1.11.5, -and .Fn mandoc_asprintf -and +since 1.12.4, .Fn mandoc_reallocarray -since 1.12.4 and 1.13.0. +since 1.13.0, and +.Fn mandoc_recallocarray +since 1.14.2. .Sh AUTHORS .An Kristaps Dzonsons Aq Mt kristaps@bsd.lv .An Ingo Schwarze Aq Mt schwarze@openbsd.org -- To unsubscribe send an email to source+unsubscribe@mandoc.bsd.lv