projects
/
collectd.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
virt plugin: Disable ExtraStats selectors when unsupported by libvirt
[collectd.git]
/
src
/
utils_fbhash.c
diff --git
a/src/utils_fbhash.c
b/src/utils_fbhash.c
index
f94e2e5
..
7c342e5
100644
(file)
--- a/
src/utils_fbhash.c
+++ b/
src/utils_fbhash.c
@@
-28,7
+28,7
@@
#include "plugin.h"
#include "plugin.h"
-#include "utils
_
avltree.h"
+#include "utils
/avltree/
avltree.h"
#include "utils_fbhash.h"
struct fbhash_s {
#include "utils_fbhash.h"
struct fbhash_s {
@@
-74,7
+74,7
@@
static int fbh_read_file(fbhash_t *h) /* {{{ */
fh = fopen(h->filename, "r");
if (fh == NULL)
fh = fopen(h->filename, "r");
if (fh == NULL)
- return
(-1)
;
+ return
-1
;
fl.l_type = F_RDLCK;
fl.l_whence = SEEK_SET;
fl.l_type = F_RDLCK;
fl.l_whence = SEEK_SET;
@@
-83,13
+83,13
@@
static int fbh_read_file(fbhash_t *h) /* {{{ */
status = fcntl(fileno(fh), F_SETLK, &fl);
if (status != 0) {
fclose(fh);
status = fcntl(fileno(fh), F_SETLK, &fl);
if (status != 0) {
fclose(fh);
- return
(-1)
;
+ return
-1
;
}
tree = c_avl_create((int (*)(const void *, const void *))strcmp);
if (tree == NULL) {
fclose(fh);
}
tree = c_avl_create((int (*)(const void *, const void *))strcmp);
if (tree == NULL) {
fclose(fh);
- return
(-1)
;
+ return
-1
;
}
/* Read `fh' into `tree' */
}
/* Read `fh' into `tree' */
@@
-102,7
+102,7
@@
static int fbh_read_file(fbhash_t *h) /* {{{ */
char *key_copy;
char *value_copy;
char *key_copy;
char *value_copy;
- buffer[sizeof(buffer) - 1] =
0
;
+ buffer[sizeof(buffer) - 1] =
'\0'
;
len = strlen(buffer);
/* Remove trailing newline characters. */
len = strlen(buffer);
/* Remove trailing newline characters. */
@@
-162,7
+162,7
@@
static int fbh_read_file(fbhash_t *h) /* {{{ */
fbh_free_tree(h->tree);
h->tree = tree;
fbh_free_tree(h->tree);
h->tree = tree;
- return
(0)
;
+ return
0
;
} /* }}} int fbh_read_file */
static int fbh_check_file(fbhash_t *h) /* {{{ */
} /* }}} int fbh_read_file */
static int fbh_check_file(fbhash_t *h) /* {{{ */
@@
-172,16
+172,16
@@
static int fbh_check_file(fbhash_t *h) /* {{{ */
status = stat(h->filename, &statbuf);
if (status != 0)
status = stat(h->filename, &statbuf);
if (status != 0)
- return
(-1)
;
+ return
-1
;
if (h->mtime >= statbuf.st_mtime)
if (h->mtime >= statbuf.st_mtime)
- return
(0)
;
+ return
0
;
status = fbh_read_file(h);
if (status == 0)
h->mtime = statbuf.st_mtime;
status = fbh_read_file(h);
if (status == 0)
h->mtime = statbuf.st_mtime;
- return
(status)
;
+ return
status
;
} /* }}} int fbh_check_file */
/*
} /* }}} int fbh_check_file */
/*
@@
-193,16
+193,16
@@
fbhash_t *fbh_create(const char *file) /* {{{ */
int status;
if (file == NULL)
int status;
if (file == NULL)
- return
(NULL)
;
+ return
NULL
;
h = calloc(1, sizeof(*h));
if (h == NULL)
h = calloc(1, sizeof(*h));
if (h == NULL)
- return
(NULL)
;
+ return
NULL
;
h->filename = strdup(file);
if (h->filename == NULL) {
free(h);
h->filename = strdup(file);
if (h->filename == NULL) {
free(h);
- return
(NULL)
;
+ return
NULL
;
}
h->mtime = 0;
}
h->mtime = 0;
@@
-212,10
+212,10
@@
fbhash_t *fbh_create(const char *file) /* {{{ */
if (status != 0) {
fbh_destroy(h);
free(h);
if (status != 0) {
fbh_destroy(h);
free(h);
- return
(NULL)
;
+ return
NULL
;
}
}
- return
(h)
;
+ return
h
;
} /* }}} fbhash_t *fbh_create */
void fbh_destroy(fbhash_t *h) /* {{{ */
} /* }}} fbhash_t *fbh_create */
void fbh_destroy(fbhash_t *h) /* {{{ */
@@
-235,7
+235,7
@@
char *fbh_get(fbhash_t *h, const char *key) /* {{{ */
int status;
if ((h == NULL) || (key == NULL))
int status;
if ((h == NULL) || (key == NULL))
- return
(NULL)
;
+ return
NULL
;
value = NULL;
value_copy = NULL;
value = NULL;
value_copy = NULL;
@@
-253,5
+253,5
@@
char *fbh_get(fbhash_t *h, const char *key) /* {{{ */
pthread_mutex_unlock(&h->lock);
pthread_mutex_unlock(&h->lock);
- return
(value_copy)
;
+ return
value_copy
;
} /* }}} char *fbh_get */
} /* }}} char *fbh_get */