From dde9e8519897e4918a93b5145bd091093c180740 Mon Sep 17 00:00:00 2001 From: Marcelo Matus Date: Fri, 13 Jan 2006 18:03:50 +0000 Subject: [PATCH] cosmetic and check for empty string in first_ucase git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@8413 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Source/Swig/misc.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Source/Swig/misc.c b/Source/Swig/misc.c index 77460ee1c..6e8cc369a 100644 --- a/Source/Swig/misc.c +++ b/Source/Swig/misc.c @@ -221,14 +221,14 @@ String *Swig_string_ucase(String *s) { * ----------------------------------------------------------------------------- */ String *Swig_string_first_ucase(String *s) { - String *ns = NewStringEmpty(); - char *cs = Char(s); - if (cs) { - Putc(toupper(cs[0]),ns); - Append(ns, cs + 1); + String *ns = NewStringEmpty(); + char *cs = Char(s); + if (cs && cs[0] != 0) { + Putc(toupper(cs[0]),ns); + Append(ns, cs + 1); + } + return ns; } - return ns; -} /* ----------------------------------------------------------------------------- * Swig_string_typecode()