]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
isc_buffer_allocate() can't fail now, change the return type to void
authorOndřej Surý <ondrej@isc.org>
Sun, 2 Feb 2020 07:00:20 +0000 (08:00 +0100)
committerOndřej Surý <ondrej@isc.org>
Mon, 3 Feb 2020 07:29:00 +0000 (08:29 +0100)
lib/isc/buffer.c
lib/isc/include/isc/buffer.h

index 66defe8bbb8d2a5181ef682df0c12846b04fb4ac..8489aa55602c6dfaea29eabc2985b32383f41d2d 100644 (file)
@@ -536,18 +536,14 @@ isc_buffer_copyregion(isc_buffer_t *b, const isc_region_t *r) {
        return (ISC_R_SUCCESS);
 }
 
-isc_result_t
+void
 isc_buffer_allocate(isc_mem_t *mctx, isc_buffer_t **dynbuffer,
                    unsigned int length)
 {
-       isc_buffer_t *dbuf;
-       unsigned char * bdata;
-       REQUIRE(dynbuffer != NULL);
-       REQUIRE(*dynbuffer == NULL);
+       REQUIRE(dynbuffer != NULL && *dynbuffer == NULL);
 
-       dbuf = isc_mem_get(mctx, sizeof(isc_buffer_t));
-
-       bdata = isc_mem_get(mctx, length);
+       isc_buffer_t *dbuf = isc_mem_get(mctx, sizeof(isc_buffer_t));
+       unsigned char *bdata = isc_mem_get(mctx, length);
 
        isc_buffer_init(dbuf, bdata, length);
 
@@ -556,8 +552,6 @@ isc_buffer_allocate(isc_mem_t *mctx, isc_buffer_t **dynbuffer,
        dbuf->mctx = mctx;
 
        *dynbuffer = dbuf;
-
-       return (ISC_R_SUCCESS);
 }
 
 isc_result_t
index 07d259956c884bed01e54c57ba614912aff2e771..4da1cfc11a9d6293dc055a572c4c8304887d43a8 100644 (file)
@@ -192,7 +192,7 @@ struct isc_buffer {
  *** Functions
  ***/
 
-isc_result_t
+void
 isc_buffer_allocate(isc_mem_t *mctx, isc_buffer_t **dynbuffer,
                    unsigned int length);
 /*!<
@@ -204,10 +204,6 @@ isc_buffer_allocate(isc_mem_t *mctx, isc_buffer_t **dynbuffer,
  *
  *\li  "dynbuffer" is non-NULL, and "*dynbuffer" is NULL.
  *
- * Returns:
- *\li  ISC_R_SUCCESS           - success
- *\li  ISC_R_NOMEMORY          - no memory available
- *
  * Note:
  *\li  Changing the buffer's length field is not permitted.
  */