diff options
author | Sebastian Gniazdowski <psprint@fastmail.com> | 2016-11-08 05:37:53 -0800 |
---|---|---|
committer | Peter Stephenson <pws@zsh.org> | 2016-11-08 15:14:08 +0000 |
commit | 06e4ec853a2ee0bde0efb8ed6c0fad2ac4162942 (patch) | |
tree | 8539bf19af45394bedcbc80bf3d9f1c3f78da262 /Src/string.c | |
parent | a57977d01acc3b1b63aec1b79394ef7ffd052912 (diff) | |
download | zsh-06e4ec853a2ee0bde0efb8ed6c0fad2ac4162942.tar.gz zsh-06e4ec853a2ee0bde0efb8ed6c0fad2ac4162942.tar.xz zsh-06e4ec853a2ee0bde0efb8ed6c0fad2ac4162942.zip |
39871: cut down number of strlen()s in getstrvalue()
Diffstat (limited to 'Src/string.c')
-rw-r--r-- | Src/string.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/Src/string.c b/Src/string.c index 04e7446c9..b46ea60cf 100644 --- a/Src/string.c +++ b/Src/string.c @@ -43,6 +43,19 @@ dupstring(const char *s) /**/ mod_export char * +dupstring_wlen(const char *s, unsigned len) +{ + char *t; + + if (!s) + return NULL; + t = (char *) zhalloc(len + 1); + strcpy(t, s); + return t; +} + +/**/ +mod_export char * ztrdup(const char *s) { char *t; |