diff options
author | Volker Lendecke <vl@samba.org> | 2009-11-12 20:44:37 +0100 |
---|---|---|
committer | Volker Lendecke <vl@samba.org> | 2009-11-14 11:03:28 +0100 |
commit | 6133ab6055f68a11380d384c1d871774139035ea (patch) | |
tree | f14233565d93284cb03b5c88ac3c143de9caa9ca | |
parent | a3632f22ec228f4e74e819305bb4c1c5aeca293c (diff) | |
download | samba-6133ab6055f68a11380d384c1d871774139035ea.tar.gz samba-6133ab6055f68a11380d384c1d871774139035ea.tar.bz2 samba-6133ab6055f68a11380d384c1d871774139035ea.zip |
s3: Tiny logic simplification
-rw-r--r-- | source3/libsmb/cliprint.c | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/source3/libsmb/cliprint.c b/source3/libsmb/cliprint.c index e78930c1d5..723ae02623 100644 --- a/source3/libsmb/cliprint.c +++ b/source3/libsmb/cliprint.c @@ -27,20 +27,21 @@ static const char *fix_char_ptr(unsigned int datap, unsigned int converter, char *rdata, int rdrcnt) { + unsigned int offset; + if (datap == 0) { /* turn NULL pointers into zero length strings */ return ""; - } else { - unsigned int offset = datap - converter; - - if (offset >= rdrcnt) { - DEBUG(1,("bad char ptr: datap=%u, converter=%u rdrcnt=%d>", - datap, converter, rdrcnt)); - return "<ERROR>"; - } else { - return &rdata[offset]; - } } + + offset = datap - converter; + + if (offset >= rdrcnt) { + DEBUG(1,("bad char ptr: datap=%u, converter=%u rdrcnt=%d>", + datap, converter, rdrcnt)); + return "<ERROR>"; + } + return &rdata[offset]; } /**************************************************************************** |