Blame SOURCES/0004-data_blob-clean-out-unused-functions.patch

97823b
From 9f1c0722a3e20047bcffe3a43f229e891da8c01b Mon Sep 17 00:00:00 2001
97823b
From: Jeff Layton <jlayton@samba.org>
97823b
Date: Wed, 9 Oct 2013 09:05:22 -0400
97823b
Subject: [PATCH] data_blob: clean out unused functions
97823b
97823b
Cut another 6k or so out of the cifs.upcall binary.
97823b
97823b
Signed-off-by: Jeff Layton <jlayton@samba.org>
97823b
---
97823b
 data_blob.c | 168 ------------------------------------------------------------
97823b
 data_blob.h |  62 ----------------------
97823b
 2 files changed, 230 deletions(-)
97823b
97823b
diff --git a/data_blob.c b/data_blob.c
97823b
index 16c78ce..834d810 100644
97823b
--- a/data_blob.c
97823b
+++ b/data_blob.c
97823b
@@ -71,18 +71,6 @@ _PUBLIC_ DATA_BLOB data_blob_talloc_named(TALLOC_CTX *mem_ctx, const void *p, si
97823b
 }
97823b
 
97823b
 /**
97823b
- construct a zero data blob, using supplied TALLOC_CTX. 
97823b
- use this sparingly as it initialises data - better to initialise
97823b
- yourself if you want specific data in the blob
97823b
-**/
97823b
-_PUBLIC_ DATA_BLOB data_blob_talloc_zero(TALLOC_CTX *mem_ctx, size_t length)
97823b
-{
97823b
-	DATA_BLOB blob = data_blob_talloc(mem_ctx, NULL, length);
97823b
-	data_blob_clear(&blob;;
97823b
-	return blob;
97823b
-}
97823b
-
97823b
-/**
97823b
 free a data blob
97823b
 **/
97823b
 _PUBLIC_ void data_blob_free(DATA_BLOB *d)
97823b
@@ -94,159 +82,3 @@ _PUBLIC_ void data_blob_free(DATA_BLOB *d)
97823b
 	}
97823b
 }
97823b
 
97823b
-/**
97823b
-clear a DATA_BLOB's contents
97823b
-**/
97823b
-_PUBLIC_ void data_blob_clear(DATA_BLOB *d)
97823b
-{
97823b
-	if (d->data) {
97823b
-		memset(d->data, 0, d->length);
97823b
-	}
97823b
-}
97823b
-
97823b
-/**
97823b
-free a data blob and clear its contents
97823b
-**/
97823b
-_PUBLIC_ void data_blob_clear_free(DATA_BLOB *d)
97823b
-{
97823b
-	data_blob_clear(d);
97823b
-	data_blob_free(d);
97823b
-}
97823b
-
97823b
-
97823b
-/**
97823b
-check if two data blobs are equal
97823b
-**/
97823b
-_PUBLIC_ int data_blob_cmp(const DATA_BLOB *d1, const DATA_BLOB *d2)
97823b
-{
97823b
-	int ret;
97823b
-	if (d1->data == NULL && d2->data != NULL) {
97823b
-		return -1;
97823b
-	}
97823b
-	if (d1->data != NULL && d2->data == NULL) {
97823b
-		return 1;
97823b
-	}
97823b
-	if (d1->data == d2->data) {
97823b
-		return d1->length - d2->length;
97823b
-	}
97823b
-	ret = memcmp(d1->data, d2->data, MIN(d1->length, d2->length));
97823b
-	if (ret == 0) {
97823b
-		return d1->length - d2->length;
97823b
-	}
97823b
-	return ret;
97823b
-}
97823b
-
97823b
-/**
97823b
-print the data_blob as hex string
97823b
-**/
97823b
-_PUBLIC_ char *data_blob_hex_string_lower(TALLOC_CTX *mem_ctx, const DATA_BLOB *blob)
97823b
-{
97823b
-	unsigned int i;
97823b
-	char *hex_string;
97823b
-
97823b
-	hex_string = talloc_array(mem_ctx, char, (blob->length*2)+1);
97823b
-	if (!hex_string) {
97823b
-		return NULL;
97823b
-	}
97823b
-
97823b
-	/* this must be lowercase or w2k8 cannot join a samba domain,
97823b
-	   as this routine is used to encode extended DNs and windows
97823b
-	   only accepts lowercase hexadecimal numbers */
97823b
-	for (i = 0; i < blob->length; i++)
97823b
-		slprintf(&hex_string[i*2], 3, "%02x", blob->data[i]);
97823b
-
97823b
-	hex_string[(blob->length*2)] = '\0';
97823b
-	return hex_string;
97823b
-}
97823b
-
97823b
-_PUBLIC_ char *data_blob_hex_string_upper(TALLOC_CTX *mem_ctx, const DATA_BLOB *blob)
97823b
-{
97823b
-	unsigned int i;
97823b
-	char *hex_string;
97823b
-
97823b
-	hex_string = talloc_array(mem_ctx, char, (blob->length*2)+1);
97823b
-	if (!hex_string) {
97823b
-		return NULL;
97823b
-	}
97823b
-
97823b
-	for (i = 0; i < blob->length; i++)
97823b
-		slprintf(&hex_string[i*2], 3, "%02X", blob->data[i]);
97823b
-
97823b
-	hex_string[(blob->length*2)] = '\0';
97823b
-	return hex_string;
97823b
-}
97823b
-
97823b
-/**
97823b
-  useful for constructing data blobs in test suites, while
97823b
-  avoiding const warnings
97823b
-**/
97823b
-_PUBLIC_ DATA_BLOB data_blob_string_const(const char *str)
97823b
-{
97823b
-	DATA_BLOB blob;
97823b
-	blob.data = discard_const_p(uint8_t, str);
97823b
-	blob.length = str ? strlen(str) : 0;
97823b
-	return blob;
97823b
-}
97823b
-
97823b
-/**
97823b
-  useful for constructing data blobs in test suites, while
97823b
-  avoiding const warnings
97823b
-**/
97823b
-_PUBLIC_ DATA_BLOB data_blob_string_const_null(const char *str)
97823b
-{
97823b
-	DATA_BLOB blob;
97823b
-	blob.data = discard_const_p(uint8_t, str);
97823b
-	blob.length = str ? strlen(str)+1 : 0;
97823b
-	return blob;
97823b
-}
97823b
-
97823b
-/**
97823b
- * Create a new data blob from const data 
97823b
- */
97823b
-
97823b
-_PUBLIC_ DATA_BLOB data_blob_const(const void *p, size_t length)
97823b
-{
97823b
-	DATA_BLOB blob;
97823b
-	blob.data = discard_const_p(uint8_t, p);
97823b
-	blob.length = length;
97823b
-	return blob;
97823b
-}
97823b
-
97823b
-
97823b
-/**
97823b
-  realloc a data_blob
97823b
-**/
97823b
-_PUBLIC_ bool data_blob_realloc(TALLOC_CTX *mem_ctx, DATA_BLOB *blob, size_t length)
97823b
-{
97823b
-	blob->data = talloc_realloc(mem_ctx, blob->data, uint8_t, length);
97823b
-	if (blob->data == NULL)
97823b
-		return false;
97823b
-	blob->length = length;
97823b
-	return true;
97823b
-}
97823b
-
97823b
-
97823b
-/**
97823b
-  append some data to a data blob
97823b
-**/
97823b
-_PUBLIC_ bool data_blob_append(TALLOC_CTX *mem_ctx, DATA_BLOB *blob,
97823b
-				   const void *p, size_t length)
97823b
-{
97823b
-	size_t old_len = blob->length;
97823b
-	size_t new_len = old_len + length;
97823b
-	if (new_len < length || new_len < old_len) {
97823b
-		return false;
97823b
-	}
97823b
-
97823b
-	if ((const uint8_t *)p + length < (const uint8_t *)p) {
97823b
-		return false;
97823b
-	}
97823b
-	
97823b
-	if (!data_blob_realloc(mem_ctx, blob, new_len)) {
97823b
-		return false;
97823b
-	}
97823b
-
97823b
-	memcpy(blob->data + old_len, p, length);
97823b
-	return true;
97823b
-}
97823b
-
97823b
diff --git a/data_blob.h b/data_blob.h
97823b
index 83e6cd5..ccdf30d 100644
97823b
--- a/data_blob.h
97823b
+++ b/data_blob.h
97823b
@@ -61,72 +61,10 @@ _PUBLIC_ DATA_BLOB data_blob_named(const void *p, size_t length, const char *nam
97823b
 _PUBLIC_ DATA_BLOB data_blob_talloc_named(TALLOC_CTX *mem_ctx, const void *p, size_t length, const char *name);
97823b
 
97823b
 /**
97823b
- construct a zero data blob, using supplied TALLOC_CTX. 
97823b
- use this sparingly as it initialises data - better to initialise
97823b
- yourself if you want specific data in the blob
97823b
-**/
97823b
-_PUBLIC_ DATA_BLOB data_blob_talloc_zero(TALLOC_CTX *mem_ctx, size_t length);
97823b
-
97823b
-/**
97823b
 free a data blob
97823b
 **/
97823b
 _PUBLIC_ void data_blob_free(DATA_BLOB *d);
97823b
 
97823b
-/**
97823b
-clear a DATA_BLOB's contents
97823b
-**/
97823b
-_PUBLIC_ void data_blob_clear(DATA_BLOB *d);
97823b
-
97823b
-/**
97823b
-free a data blob and clear its contents
97823b
-**/
97823b
-_PUBLIC_ void data_blob_clear_free(DATA_BLOB *d);
97823b
-
97823b
-/**
97823b
-check if two data blobs are equal
97823b
-**/
97823b
-_PUBLIC_ int data_blob_cmp(const DATA_BLOB *d1, const DATA_BLOB *d2);
97823b
-
97823b
-/**
97823b
-print the data_blob as hex string
97823b
-**/
97823b
-_PUBLIC_ char *data_blob_hex_string_upper(TALLOC_CTX *mem_ctx, const DATA_BLOB *blob);
97823b
-
97823b
-/**
97823b
-print the data_blob as hex string
97823b
-**/
97823b
-_PUBLIC_ char *data_blob_hex_string_lower(TALLOC_CTX *mem_ctx, const DATA_BLOB *blob);
97823b
-
97823b
-/**
97823b
-  useful for constructing data blobs in test suites, while
97823b
-  avoiding const warnings
97823b
-**/
97823b
-_PUBLIC_ DATA_BLOB data_blob_string_const(const char *str);
97823b
-
97823b
-/**
97823b
-  useful for constructing data blobs in test suites, while
97823b
-  avoiding const warnings
97823b
-
97823b
-  includes the terminating null character (as opposed to data_blo_string_const)
97823b
-**/
97823b
-_PUBLIC_ DATA_BLOB data_blob_string_const_null(const char *str);
97823b
-
97823b
-/**
97823b
- * Create a new data blob from const data 
97823b
- */
97823b
-_PUBLIC_ DATA_BLOB data_blob_const(const void *p, size_t length);
97823b
-
97823b
-/**
97823b
-  realloc a data_blob
97823b
-**/
97823b
-_PUBLIC_ bool data_blob_realloc(TALLOC_CTX *mem_ctx, DATA_BLOB *blob, size_t length);
97823b
-
97823b
-/**
97823b
-  append some data to a data blob
97823b
-**/
97823b
-_PUBLIC_ bool data_blob_append(TALLOC_CTX *mem_ctx, DATA_BLOB *blob,
97823b
-				   const void *p, size_t length);
97823b
-
97823b
 extern const DATA_BLOB data_blob_null;
97823b
 
97823b
 #endif /* _SAMBA_DATABLOB_H_ */
97823b
-- 
97823b
1.8.3.1
97823b