r6980: added data_blob_append(), which I use in the web server
authorAndrew Tridgell <tridge@samba.org>
Thu, 26 May 2005 01:00:58 +0000 (01:00 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 18:17:01 +0000 (13:17 -0500)
source/lib/data_blob.c

index 2ec21717b1372052026f1f8f88927d570038e3ad..049210e8eeea73691495031cc43c9e0b4ffef1e1 100644 (file)
@@ -180,3 +180,16 @@ DATA_BLOB data_blob_const(const void *p, size_t length)
        blob.length = length;
        return blob;
 }
+
+
+/*
+  append some data to a data blob
+*/
+NTSTATUS data_blob_append(TALLOC_CTX *mem_ctx, DATA_BLOB *blob, void *p, size_t length)
+{
+       blob->data = talloc_realloc_size(mem_ctx, blob->data, blob->length + length);
+       NT_STATUS_HAVE_NO_MEMORY(blob->data);   
+       memcpy(blob->data + blob->length, p, length);
+       blob->length += length;
+       return NT_STATUS_OK;
+}