summaryrefslogtreecommitdiff
path: root/ctdb
diff options
context:
space:
mode:
authorMartin Schwenke <martin@meltin.net>2014-08-06 16:36:58 +1000
committerAmitay Isaacs <amitay@samba.org>2014-09-10 01:36:14 +0200
commit94a5e28ffb53a268865666038678e78cbbb39de3 (patch)
tree3285b83c6b54712e7b505328fd66b3b4b20f67f2 /ctdb
parentf031d5b43fb272fbccc570dd174536c55e78ad47 (diff)
downloadsamba-94a5e28ffb53a268865666038678e78cbbb39de3.tar.gz
ctdb-common: Move hex_decode_talloc() to the lock helper
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>
Diffstat (limited to 'ctdb')
-rw-r--r--ctdb/include/internal/includes.h1
-rw-r--r--ctdb/lib/util/util_file.c16
-rw-r--r--ctdb/server/ctdb_lock_helper.c16
3 files changed, 16 insertions, 17 deletions
diff --git a/ctdb/include/internal/includes.h b/ctdb/include/internal/includes.h
index d3227a2beea..396965f8866 100644
--- a/ctdb/include/internal/includes.h
+++ b/ctdb/include/internal/includes.h
@@ -66,7 +66,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"
diff --git a/ctdb/lib/util/util_file.c b/ctdb/lib/util/util_file.c
index 3a90201cce7..21d64b20e3d 100644
--- a/ctdb/lib/util/util_file.c
+++ b/ctdb/lib/util/util_file.c
@@ -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;
-}
diff --git a/ctdb/server/ctdb_lock_helper.c b/ctdb/server/ctdb_lock_helper.c
index d0a2a891ff5..9e7535983e2 100644
--- a/ctdb/server/ctdb_lock_helper.c
+++ b/ctdb/server/ctdb_lock_helper.c
@@ -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 *dbkey)
{