Author: adrian.chadd
Date: Mon Feb 2 11:31:02 2009
New Revision: 13786
Modified:
branches/LUSCA_HEAD/libmem/String.c
Log:
Make code match the intended use of the function; add documentation
describing what the function does!
Modified: branches/LUSCA_HEAD/libmem/String.c
==============================================================================
--- branches/LUSCA_HEAD/libmem/String.c (original)
+++ branches/LUSCA_HEAD/libmem/String.c Mon Feb 2 11:31:02 2009
@@ -131,6 +131,7 @@
/*
* This routine REQUIRES the string to be something and not NULL
+ * This copies -from- offset to the end of the string.
*/
char *
stringDupToCOffset(const String *s, int offset)
@@ -139,7 +140,7 @@
assert(s->buf);
assert(offset <= s->len);
d = xmalloc(s->len + 1 - offset);
- memcpy(d, s->buf, s->len - offset);
+ memcpy(d, s->buf + offset, s->len - offset);
d[s->len - offset] = '\0';
return d;
}
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"lusca-commit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/lusca-commit?hl=en
-~----------~----~----~----~------~----~------~--~---