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

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