--- uuid.c 2004/01/09 16:11:40 1.7
+++ uuid.c 2004/01/09 21:01:04 1.8
@@ -317,7 +317,6 @@
uuid_rc_t uuid_parse(uuid_t *uuid, const char *str)
{
- uuid_t uuid_tmp;
uuid_uint16_t tmp16;
const char *cp;
char hexbuf[3];
@@ -353,18 +352,18 @@
/*
* pass 2: parse hex values of string representation syntax
*/
- uuid_tmp.time_low = (uuid_uint32_t)strtoul(str, NULL, 16);
- uuid_tmp.time_mid = (uuid_uint16_t)strtoul(str+9, NULL, 16);
- uuid_tmp.time_hi_and_version = (uuid_uint16_t)strtoul(str+14, NULL, 16);
+ uuid->time_low = (uuid_uint32_t)strtoul(str, NULL, 16);
+ uuid->time_mid = (uuid_uint16_t)strtoul(str+9, NULL, 16);
+ uuid->time_hi_and_version = (uuid_uint16_t)strtoul(str+14, NULL, 16);
tmp16 = (uuid_uint16_t)strtoul(str+19, NULL, 16);
- uuid_tmp.clock_seq_low = (uuid_uint8_t)(tmp16 & 0xff); tmp16 >>= 8;
- uuid_tmp.clock_seq_hi_and_reserved = (uuid_uint8_t)(tmp16 & 0xff);
+ uuid->clock_seq_low = (uuid_uint8_t)(tmp16 & 0xff); tmp16 >>= 8;
+ uuid->clock_seq_hi_and_reserved = (uuid_uint8_t)(tmp16 & 0xff);
cp = str+24;
hexbuf[2] = '\0';
- for (i = 0; i < sizeof(uuid_tmp.node); i++) {
+ for (i = 0; i < sizeof(uuid->node); i++) {
hexbuf[0] = *cp++;
hexbuf[1] = *cp++;
- uuid_tmp.node[i] = strtoul(hexbuf, NULL, 16);
+ uuid->node[i] = strtoul(hexbuf, NULL, 16);
}
return UUID_RC_OK;
@@ -372,8 +371,6 @@
uuid_rc_t uuid_format(uuid_t *uuid, char **str)
{
- uuid_t uuid_tmp;
-
/* sanity check argument(s) */
if (uuid == NULL || str == NULL)
return UUID_RC_ARG;
@@ -386,17 +383,17 @@
/* format UUID into string representation */
sprintf(*str,
"%08lx-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x",
- (unsigned long)uuid_tmp.time_low,
- (unsigned int)uuid_tmp.time_mid,
- (unsigned int)uuid_tmp.time_hi_and_version,
- (unsigned int)uuid_tmp.clock_seq_hi_and_reserved,
- (unsigned int)uuid_tmp.clock_seq_low,
- (unsigned int)uuid_tmp.node[0],
- (unsigned int)uuid_tmp.node[1],
- (unsigned int)uuid_tmp.node[2],
- (unsigned int)uuid_tmp.node[3],
- (unsigned int)uuid_tmp.node[4],
- (unsigned int)uuid_tmp.node[5]);
+ (unsigned long)uuid->time_low,
+ (unsigned int)uuid->time_mid,
+ (unsigned int)uuid->time_hi_and_version,
+ (unsigned int)uuid->clock_seq_hi_and_reserved,
+ (unsigned int)uuid->clock_seq_low,
+ (unsigned int)uuid->node[0],
+ (unsigned int)uuid->node[1],
+ (unsigned int)uuid->node[2],
+ (unsigned int)uuid->node[3],
+ (unsigned int)uuid->node[4],
+ (unsigned int)uuid->node[5]);
return UUID_RC_OK;
}
|