diff options
author | Dan Crowell <dcrowell@us.ibm.com> | 2014-01-07 09:30:51 -0600 |
---|---|---|
committer | A. Patrick Williams III <iawillia@us.ibm.com> | 2014-01-10 16:19:14 -0600 |
commit | aa83ebd12d6cf6d6ead06e45ab61d46a53a15be3 (patch) | |
tree | d6a587a8582ac9d085b08e028c757a0ea94bb825 /src/lib | |
parent | ea2a49ff0cd3827458025f75d5b6bd7054d18779 (diff) | |
download | talos-hostboot-aa83ebd12d6cf6d6ead06e45ab61d46a53a15be3.tar.gz talos-hostboot-aa83ebd12d6cf6d6ead06e45ab61d46a53a15be3.zip |
Remove leftover fixme/todo and update error callouts
Remove all untagged fixme/todo comments
Adde new parm to error log constructor to avoid extra code in
common software error case
Update error callouts
Add strncpy
Change-Id: I8bd8f48193a96b79db91ed35c4fd485e6da38dba
RTC: 67921
Reviewed-on: http://gfw160.aus.stglabs.ibm.com:8080/gerrit/7921
Tested-by: Jenkins Server
Reviewed-by: Michael Baiocchi <baiocchi@us.ibm.com>
Reviewed-by: Brian H. Horton <brianh@linux.ibm.com>
Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com>
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/string.C | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/src/lib/string.C b/src/lib/string.C index 52c54a56b..17194bdd2 100644 --- a/src/lib/string.C +++ b/src/lib/string.C @@ -5,7 +5,7 @@ /* */ /* IBM CONFIDENTIAL */ /* */ -/* COPYRIGHT International Business Machines Corp. 2011,2013 */ +/* COPYRIGHT International Business Machines Corp. 2011,2014 */ /* */ /* p1 */ /* */ @@ -170,6 +170,28 @@ extern "C" char* strcpy(char* d, const char* s) } while(1); } +extern "C" char* strncpy(char* d, const char* s, size_t l) +{ + char* d1 = d; + size_t len = 0; + + do + { + if (len++ >= l) break; + *d1 = *s; + if (*s == '\0') break; + d1++; s++; + } while(1); + + // pad the remainder + while( len < l ) + { + d1[len++] = '\0'; + } + + return d; +} + extern "C" int strcmp(const char* a, const char* b) { while((*a != '\0') && (*b != '\0')) |