summaryrefslogtreecommitdiff
path: root/gdb/utils.c
diff options
context:
space:
mode:
authorPedro Alves <palves@redhat.com>2013-02-14 17:08:57 +0000
committerPedro Alves <palves@redhat.com>2013-02-14 17:08:57 +0000
commit201a98005e53f66a7f3d4bd51d7b28f592a250a7 (patch)
tree92bb527f63d401baa599d93188e355a5d39996d2 /gdb/utils.c
parent8aec93acf907888393d8bf27f6ac4dcb3f070c92 (diff)
downloadgdb-201a98005e53f66a7f3d4bd51d7b28f592a250a7.tar.gz
savestring: Rename parameter 'size' to 'len'.
It's better to avoid needless confusion, and call string length, length, instead of size, which is usually used to refer to sizeof of the string (len+1): size_t len = strlen (str); size_t size = sizeof (str); Tested on x86_64 Fedora 17. 2013-02-14 Pedro Alves <palves@redhat.com> * utils.c (savestring): Rename parameter 'size' to 'len'.
Diffstat (limited to 'gdb/utils.c')
-rw-r--r--gdb/utils.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/gdb/utils.c b/gdb/utils.c
index 282ab8b9b0e..408c6ce0888 100644
--- a/gdb/utils.c
+++ b/gdb/utils.c
@@ -1186,17 +1186,17 @@ myread (int desc, char *addr, int len)
return orglen;
}
-/* Make a copy of the string at PTR with SIZE characters
+/* Make a copy of the string at PTR with LEN characters
(and add a null character at the end in the copy).
Uses malloc to get the space. Returns the address of the copy. */
char *
-savestring (const char *ptr, size_t size)
+savestring (const char *ptr, size_t len)
{
- char *p = (char *) xmalloc (size + 1);
+ char *p = (char *) xmalloc (len + 1);
- memcpy (p, ptr, size);
- p[size] = 0;
+ memcpy (p, ptr, len);
+ p[len] = 0;
return p;
}