Jim Apple has uploaded a new change for review.

  http://gerrit.cloudera.org:8080/6767

Change subject: IMPALA-5031: remove undefined behavior: call to strncmp with 
nullptr
......................................................................

IMPALA-5031: remove undefined behavior: call to strncmp with nullptr

Calling strncmp with a nullptr is undefined, following paragraph 2 of
section 7.21.1 of the C99 standard (which is included by reference in
C++14). That paragraph states: "Unless explicitly stated otherwise in
the description of a particular function in this subclause, pointer
arguments on such a call shall still have valid values, as described
in 7.1.4." Section 7.1.4 excludes null pointers from "valid values":
"If an argument to a function has an invalid value (such as a value
outside the domain of the function, or a pointer outside the address
space of the program, or a null pointer, or a pointer to
non-modifiable storage when the corresponding parameter is not
const-qualified) or a type (after promotion) not expected by a
function with variable number of arguments, the behavior is
undefined."

I tested this change with string-compare-benchmark.cc and there was no
performance difference.

Change-Id: Id563e81720a0a4847664fa2828ecfdcad870da5b
---
M be/src/benchmarks/string-compare-benchmark.cc
M be/src/runtime/string-value.inline.h
2 files changed, 3 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.cloudera.org:29418/Impala-ASF refs/changes/67/6767/1
-- 
To view, visit http://gerrit.cloudera.org:8080/6767
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Id563e81720a0a4847664fa2828ecfdcad870da5b
Gerrit-PatchSet: 1
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-Owner: Jim Apple <[email protected]>

Reply via email to