svn commit: samba r23807 - in branches/SAMBA_4_0/source/lib/util: .

tridge at samba.org tridge at samba.org
Tue Jul 10 08:07:43 GMT 2007


Author: tridge
Date: 2007-07-10 08:07:42 +0000 (Tue, 10 Jul 2007)
New Revision: 23807

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=23807

Log:

added hex_encode_talloc()

Modified:
   branches/SAMBA_4_0/source/lib/util/util_str.c


Changeset:
Modified: branches/SAMBA_4_0/source/lib/util/util_str.c
===================================================================
--- branches/SAMBA_4_0/source/lib/util/util_str.c	2007-07-10 08:06:51 UTC (rev 23806)
+++ branches/SAMBA_4_0/source/lib/util/util_str.c	2007-07-10 08:07:42 UTC (rev 23807)
@@ -245,6 +245,22 @@
 }
 
 /**
+ * talloc version of hex_encode()
+ */
+_PUBLIC_ char *hex_encode_talloc(TALLOC_CTX *mem_ctx, const unsigned char *buff_in, size_t len)
+{
+	int i;
+	char *hex_buffer;
+
+	hex_buffer = talloc_array(mem_ctx, char, (len*2)+1);
+
+	for (i = 0; i < len; i++)
+		slprintf(&hex_buffer[i*2], 3, "%02X", buff_in[i]);
+
+	return hex_buffer;
+}
+
+/**
  Set a string value, allocing the space for the string
 **/
 static BOOL string_init(char **dest,const char *src)



More information about the samba-cvs mailing list