Fix for printing null pointer with %p

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@14490 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
CaS 2002-09-19 16:47:49 +00:00
parent a20d698ce9
commit a242f0ee15
2 changed files with 4 additions and 9 deletions

View file

@ -1,5 +1,7 @@
2002-09-19 Richard Frith-Macdonald <rfm@gnu.org> 2002-09-19 Richard Frith-Macdonald <rfm@gnu.org>
* Source/GSFormat.m: Where a %p format prints a null pointer,
print the text (null).
* Source/GSTcpHandle.m: Check port for invalidation while looping * Source/GSTcpHandle.m: Check port for invalidation while looping
on write events, so we can fail if we become invalid while sending on write events, so we can fail if we become invalid while sending
or connecting, before the port timeout expires. or connecting, before the port timeout expires.

View file

@ -1649,14 +1649,8 @@ NSDictionary *locale)
} }
else else
{ {
unichar nil_name[] = {'(','n','i','l',')','\0'}; string = NULL;
/* Write "(nil)" for a nil pointer. */ goto LABEL (print_string);
string = nil_name;
/* Make sure the full string "(nil)" is printed. */
if (prec < 5)
prec = 5;
string_malloced = 0;
goto LABEL (print_uni_string);
} }
} }
/* NOTREACHED */ /* NOTREACHED */
@ -1788,7 +1782,6 @@ NSDictionary *locale)
while (prc--) *sp = *wsp; while (prc--) *sp = *wsp;
} }
LABEL (print_uni_string):
if ((width -= len) <= 0) if ((width -= len) <= 0)
{ {
outstring (string, len); outstring (string, len);