Project

General

Profile

Actions

Bug #942

closed

eliminate NULL/empty string confusion in g_conf

Added by Colin McCabe about 13 years ago. Updated about 13 years ago.

Status:
Resolved
Priority:
Normal
Assignee:
Category:
-
Target version:
% Done:

0%

Source:
Tags:
Backport:
Regression:
Severity:
Reviewed:
Affected Versions:
ceph-qa-suite:
Pull request ID:
Crash signature (v1):
Crash signature (v2):

Description

Right now there are two ways to indicate that a string has "no value" in g_conf: either you can set a string's value to NULL, or you can set it to the empty string. This causes unecessarily complex code like

if ((!g_conf.foo) || (g_conf.foo[0])) {
  // no value...
}

There are no doubt a bunch of bugs lurking where code only checks for one empty condition or the other.

To eliminate this confusion, and probably fix a bunch of memory leaks related to our use of strdup, we should just hold our string configuration values in std::string. We're not gaining much, if any, efficiency by using C-styles strings anyway, since we always use dynamic allocation.

Actions #1

Updated by Sage Weil about 13 years ago

  • Target version set to v0.27
  • Translation missing: en.field_position set to 3
Actions #2

Updated by Sage Weil about 13 years ago

  • Translation missing: en.field_story_points set to 3
  • Translation missing: en.field_position deleted (4)
  • Translation missing: en.field_position set to 4
Actions #3

Updated by Sage Weil about 13 years ago

  • Assignee set to Colin McCabe
Actions #4

Updated by Colin McCabe about 13 years ago

  • Status changed from New to Resolved
Actions

Also available in: Atom PDF