Extracted duplicate hexval().
This commit is contained in:
parent
620570691e
commit
39d9f9e499
12
gdb.c
12
gdb.c
|
@ -179,18 +179,6 @@ static void gdb_packet_end(struct gdb_data *data)
|
||||||
gdb_printf(data, "#%02x", c);
|
gdb_printf(data, "#%02x", c);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int hexval(int c)
|
|
||||||
{
|
|
||||||
if (isdigit(c))
|
|
||||||
return c - '0';
|
|
||||||
if (isupper(c))
|
|
||||||
return c - 'A' + 10;
|
|
||||||
if (islower(c))
|
|
||||||
return c - 'a' + 10;
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int gdb_send(struct gdb_data *data, const char *msg)
|
static int gdb_send(struct gdb_data *data, const char *msg)
|
||||||
{
|
{
|
||||||
gdb_packet_start(data);
|
gdb_packet_start(data);
|
||||||
|
|
10
srec.c
10
srec.c
|
@ -45,16 +45,6 @@ int srec_check(FILE *in)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int hexval(int c)
|
|
||||||
{
|
|
||||||
if (isdigit(c))
|
|
||||||
return c - '0';
|
|
||||||
if (c >= 'A' && c <= 'F')
|
|
||||||
return c - 'A' + 10;
|
|
||||||
|
|
||||||
return c - 'a' + 10;
|
|
||||||
}
|
|
||||||
|
|
||||||
int srec_extract(FILE *in, binfile_imgcb_t cb, void *user_data)
|
int srec_extract(FILE *in, binfile_imgcb_t cb, void *user_data)
|
||||||
{
|
{
|
||||||
char buf[128];
|
char buf[128];
|
||||||
|
|
12
util.c
12
util.c
|
@ -317,3 +317,15 @@ void debug_hexdump(const char *label, const uint8_t *data, int len)
|
||||||
offset += i;
|
offset += i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int hexval(int c)
|
||||||
|
{
|
||||||
|
if (isdigit(c))
|
||||||
|
return c - '0';
|
||||||
|
if (isupper(c))
|
||||||
|
return c - 'A' + 10;
|
||||||
|
if (islower(c))
|
||||||
|
return c - 'a' + 10;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue