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

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