mirror of
https://github.com/samba-team/samba.git
synced 2025-02-03 13:47:25 +03:00
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>
This commit is contained in:
parent
f031d5b43f
commit
94a5e28ffb
@ -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"
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user