common: Move hex_decode_talloc() to the lock helper
authorMartin Schwenke <martin@meltin.net>
Wed, 6 Aug 2014 06:36:58 +0000 (16:36 +1000)
committerAmitay Isaacs <amitay@gmail.com>
Fri, 27 Mar 2015 02:52:52 +0000 (13:52 +1100)
This is the only place it is used.

After migrating to Samba's lib/util, the lock helper can be changed to
use strhex_to_data_blob().

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
(Imported from commit 94a5e28ffb53a268865666038678e78cbbb39de3)

include/internal/includes.h
lib/util/util_file.c
server/ctdb_lock_helper.c

index 698cb26efc5b119a7dbcc69b2bd98dda3e1583b8..d5ac697beb1cbb20df936169ab2bc561d4544324 100644 (file)
@@ -58,7 +58,6 @@ double timeval_elapsed(struct timeval *tv);
 double timeval_delta(struct timeval *tv2, struct timeval *tv);
 char **file_lines_load(const char *fname, int *numlines, TALLOC_CTX *mem_ctx);
 char *hex_encode_talloc(TALLOC_CTX *mem_ctx, const unsigned char *buff_in, size_t len);
-uint8_t *hex_decode_talloc(TALLOC_CTX *mem_ctx, const char *hex_in, size_t *len);
 _PUBLIC_ int set_blocking(int fd, bool set);
 
 #include "lib/util/debug.h"
index 3a90201cce70c403111cd484fa3e2324a2e763b0..21d64b20e3dab574b9d872bce71cebbcbfc05bae 100644 (file)
@@ -114,19 +114,3 @@ char *hex_encode_talloc(TALLOC_CTX *mem_ctx, const unsigned char *buff_in, size_
 
        return hex_buffer;
 }
-
-uint8_t *hex_decode_talloc(TALLOC_CTX *mem_ctx, const char *hex_in, size_t *len)
-{
-       int i, num;
-       uint8_t *buffer;
-
-       *len = strlen(hex_in) / 2;
-       buffer = talloc_array(mem_ctx, unsigned char, *len);
-
-       for (i=0; i<*len; i++) {
-               sscanf(&hex_in[i*2], "%02X", &num);
-               buffer[i] = (uint8_t)num;
-       }
-
-       return buffer;
-}
index c68e5e707554a7e4ee141b7396638fe338658947..7a09ecf3c70edc9777c066384496f97db6407dd1 100644 (file)
@@ -42,6 +42,22 @@ static void usage(void)
                progname);
 }
 
+static uint8_t *hex_decode_talloc(TALLOC_CTX *mem_ctx,
+                                 const char *hex_in, size_t *len)
+{
+       int i, num;
+       uint8_t *buffer;
+
+       *len = strlen(hex_in) / 2;
+       buffer = talloc_array(mem_ctx, unsigned char, *len);
+
+       for (i=0; i<*len; i++) {
+               sscanf(&hex_in[i*2], "%02X", &num);
+               buffer[i] = (uint8_t)num;
+       }
+
+       return buffer;
+}
 
 static int lock_record(const char *dbpath, const char *dbflags, const char *dbkey)
 {