summaryrefslogtreecommitdiffstats
path: root/usr.bin/rcs
diff options
context:
space:
mode:
authorray <ray@openbsd.org>2006-04-05 01:38:55 +0000
committerray <ray@openbsd.org>2006-04-05 01:38:55 +0000
commit3b4c5c25821bd1bd0865b7b0cdf20c9c1163373c (patch)
tree646ef8b493f8d6bb92577891c01d3ed66d64c83c /usr.bin/rcs
parentPowerBook3,3 has tumbler (diff)
downloadwireguard-openbsd-3b4c5c25821bd1bd0865b7b0cdf20c9c1163373c.tar.xz
wireguard-openbsd-3b4c5c25821bd1bd0865b7b0cdf20c9c1163373c.zip
Use variable names for sizeof, remove casts in front of xmalloc,
use xcalloc and xstrdup where appropriate, and other stuff. OK joris@
Diffstat (limited to 'usr.bin/rcs')
-rw-r--r--usr.bin/rcs/ci.c18
1 files changed, 5 insertions, 13 deletions
diff --git a/usr.bin/rcs/ci.c b/usr.bin/rcs/ci.c
index 451adcfabde..7acabc4b24d 100644
--- a/usr.bin/rcs/ci.c
+++ b/usr.bin/rcs/ci.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ci.c,v 1.134 2006/04/01 13:57:48 niallo Exp $ */
+/* $OpenBSD: ci.c,v 1.135 2006/04/05 01:38:56 ray Exp $ */
/*
* Copyright (c) 2005, 2006 Niall O'Higgins <niallo@openbsd.org>
* All rights reserved.
@@ -1014,12 +1014,8 @@ checkin_parsekeyword(char *keystring, RCSNUM **rev, time_t *date,
if ((*rev = rcsnum_parse(tokens[2])) == NULL)
fatal("could not parse rcsnum");
}
- len = strlen(tokens[5]) + 1;
- *author = xmalloc(len);
- strlcpy(*author, tokens[5], len);
- len = strlen(tokens[6]) + 1;
- *state = xmalloc(len);
- strlcpy(*state, tokens[6], len);
+ *author = xstrdup(tokens[5]);
+ *author = xstrdup(tokens[6]);
len = strlen(tokens[3]) + strlen(tokens[4]) + 2;
datestring = xmalloc(len);
strlcpy(datestring, tokens[3], len);
@@ -1037,9 +1033,7 @@ checkin_parsekeyword(char *keystring, RCSNUM **rev, time_t *date,
}
if (*author != NULL)
xfree(*author);
- len = strlen(tokens[1]) + 1;
- *author = xmalloc(len);
- strlcpy(*author, tokens[1], len);
+ *author = xstrdup(tokens[1]);
break;
case KW_TYPE_DATE:
for ((p = strtok(keystring, " ")); p;
@@ -1064,9 +1058,7 @@ checkin_parsekeyword(char *keystring, RCSNUM **rev, time_t *date,
}
if (*state != NULL)
xfree(*state);
- len = strlen(tokens[1]) + 1;
- *state = xmalloc(len);
- strlcpy(*state, tokens[1], len);
+ *state = xstrdup(tokens[1]);
break;
case KW_TYPE_REVISION:
/* only parse revision if one is not already set */