[Openmp-commits] [PATCH] D54948: Minor cleanup of debug code

Andrey Churbanov via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Tue Nov 27 05:55:20 PST 2018


AndreyChurbanov created this revision.
AndreyChurbanov added reviewers: tlwilmar, jlpeyton, hbae.
Herald added a subscriber: openmp-commits.

- fixed calculation of string length;
- removed NULL-check of pointer which has been dereferenced.


Repository:
  rOMP OpenMP

https://reviews.llvm.org/D54948

Files:
  runtime/src/kmp_settings.cpp


Index: runtime/src/kmp_settings.cpp
===================================================================
--- runtime/src/kmp_settings.cpp
+++ runtime/src/kmp_settings.cpp
@@ -410,7 +410,7 @@
                                       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 @@
   __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, '=')) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D54948.175467.patch
Type: text/x-patch
Size: 867 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20181127/95abd585/attachment.bin>


More information about the Openmp-commits mailing list