projects
/
collectd.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
73bb33b
)
libvirt plugin: Don't copy a string if it is not necessary.
author
Florian Forster
<octo@leeloo.lan.home.verplant.org>
Tue, 1 Jun 2010 14:17:31 +0000
(16:17 +0200)
committer
Florian Forster
<octo@leeloo.lan.home.verplant.org>
Tue, 1 Jun 2010 14:17:31 +0000
(16:17 +0200)
src/libvirt.c
patch
|
blob
|
history
diff --git
a/src/libvirt.c
b/src/libvirt.c
index
d97f90a
..
6732656
100644
(file)
--- a/
src/libvirt.c
+++ b/
src/libvirt.c
@@
-113,7
+113,6
@@
static enum hf_field hostname_format[HF_MAX_FIELDS] =
{ hf_name };
/* InterfaceFormat. */
{ hf_name };
/* InterfaceFormat. */
-
enum if_field {
if_address,
if_name
enum if_field {
if_address,
if_name
@@
-253,24
+252,14
@@
lv_config (const char *key, const char *value)
}
if (strcasecmp (key, "InterfaceFormat") == 0) {
}
if (strcasecmp (key, "InterfaceFormat") == 0) {
- char *value_copy;
-
- value_copy = strdup (value);
- if (value_copy == NULL) {
- ERROR ("libvirt plugin: strdup failed.");
- return -1;
- }
-
- if (strcasecmp (value_copy, "name") == 0)
+ if (strcasecmp (value, "name") == 0)
interface_format = if_name;
interface_format = if_name;
- else if (strcasecmp (value
_copy
, "address") == 0)
+ else if (strcasecmp (value, "address") == 0)
interface_format = if_address;
else {
interface_format = if_address;
else {
- free (value_copy);
- ERROR ("unknown InterfaceFormat: %s", value_copy);
+ ERROR ("unknown InterfaceFormat: %s", value);
return -1;
}
return -1;
}
- free (value_copy);
return 0;
}
return 0;
}