diff options
author | Mark Wielaard <mjw@redhat.com> | 2009-04-01 23:04:29 +0200 |
---|---|---|
committer | Mark Wielaard <mjw@redhat.com> | 2009-04-01 23:04:29 +0200 |
commit | 2c246d55893998d60461671767c5f9c05f70c6b7 (patch) | |
tree | 04e20f69c813c67534d8a3bd9cd0d4cad84a3544 /runtime/map.c | |
parent | dd1636396623adacdb9e6502adabd9195ae7ef33 (diff) | |
parent | 952ce18c9672046c052fc77d5da8f98e8ae75735 (diff) | |
download | systemtap-steved-2c246d55893998d60461671767c5f9c05f70c6b7.tar.gz systemtap-steved-2c246d55893998d60461671767c5f9c05f70c6b7.tar.xz systemtap-steved-2c246d55893998d60461671767c5f9c05f70c6b7.zip |
Merge branch 'master' into pr6866
Diffstat (limited to 'runtime/map.c')
-rw-r--r-- | runtime/map.c | 21 |
1 files changed, 5 insertions, 16 deletions
diff --git a/runtime/map.c b/runtime/map.c index de25d6f3..190ba91b 100644 --- a/runtime/map.c +++ b/runtime/map.c @@ -38,27 +38,16 @@ static int int64_eq_p (int64_t key1, int64_t key2) static void str_copy(char *dest, char *src) { - int len = 0; - if (src) { - len = strlen(src); - if (len > MAP_STRING_LENGTH - 1) - len = MAP_STRING_LENGTH - 1; - memcpy (dest, src, len); - } - dest[len] = 0; + if (src) + strlcpy(dest, src, MAP_STRING_LENGTH); + else + *dest = 0; } static void str_add(void *dest, char *val) { char *dst = (char *)dest; - int len = strlen(val); - int len1 = strlen(dst); - int num = MAP_STRING_LENGTH - 1 - len1; - - if (len > num) - len = num; - memcpy (&dst[len1], val, len); - dst[len + len1] = 0; + strlcat(dst, val, MAP_STRING_LENGTH); } static int str_eq_p (char *key1, char *key2) |