]> granicus.if.org Git - nethack/commit
safe_oname (trunk only)
authornethack.allison <nethack.allison>
Sat, 15 Apr 2006 15:40:27 +0000 (15:40 +0000)
committernethack.allison <nethack.allison>
Sat, 15 Apr 2006 15:40:27 +0000 (15:40 +0000)
commit78ef9ef99141a98de0633b130c3b59e55a9e0b7c
treefb16ee24c8131972398a52adfd43744bad21c44a
parentc16a87d3670b9c7c1380f9bfd29c8caa79a16080
safe_oname (trunk only)

There were routines that were passed the
object name as an argument.  Before the oextra
patch, ONAME() always returned a valid pointer
to a location within the obj struct. The oextra
patch worked around those cases by
using a temporary variable that was either set
to ONAME (if the obj passed the has_oname() test),
or to ""  (pointer to an empty string) if no name was
present.

Since that might be a common thing to do, provide
the safe_oname() routine that you can use as a
function parameter without having to worry about
about whether ONAME(obj) is valid, and without
the need for the temporary variable.
include/extern.h
src/bones.c
src/do_name.c
src/objnam.c