[OpenMP] Minor cleanup of debug code
authorJonathan Peyton <jonathan.l.peyton@intel.com>
Wed, 28 Nov 2018 20:18:06 +0000 (20:18 +0000)
committerJonathan Peyton <jonathan.l.peyton@intel.com>
Wed, 28 Nov 2018 20:18:06 +0000 (20:18 +0000)
* Fix calculation of string length.
* Remove NULL-check of pointer which has been dereferenced.

Patch by Andrey Churbanov

Differential Revision: https://reviews.llvm.org/D54948

llvm-svn: 347801

openmp/runtime/src/kmp_settings.cpp

index d855de8..7cb5d36 100644 (file)
@@ -410,7 +410,7 @@ static void __kmp_stg_parse_par_range(char const *name, char const *value,
                                       int *out_range, char *out_routine,
                                       char *out_file, int *out_lb,
                                       int *out_ub) {
-  size_t len = KMP_STRLEN(value + 1);
+  size_t len = KMP_STRLEN(value) + 1;
   par_range_to_print = (char *)KMP_INTERNAL_MALLOC(len + 1);
   KMP_STRNCPY_S(par_range_to_print, len + 1, value, len + 1);
   __kmp_par_range = +1;
@@ -418,7 +418,7 @@ static void __kmp_stg_parse_par_range(char const *name, char const *value,
   __kmp_par_range_ub = INT_MAX;
   for (;;) {
     unsigned int len;
-    if ((value == NULL) || (*value == '\0')) {
+    if (*value == '\0') {
       break;
     }
     if (!__kmp_strcasecmp_with_sentinel("routine", value, '=')) {