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

Also available in: Atom PDF