diff options
Diffstat (limited to 'libnetdata/libnetdata.h')
-rw-r--r-- | libnetdata/libnetdata.h | 106 |
1 files changed, 9 insertions, 97 deletions
diff --git a/libnetdata/libnetdata.h b/libnetdata/libnetdata.h index daa247f1fb..39c50681b7 100644 --- a/libnetdata/libnetdata.h +++ b/libnetdata/libnetdata.h @@ -201,6 +201,8 @@ extern "C" { // ---------------------------------------------------------------------------- // netdata common definitions +#define _cleanup_(x) __attribute__((__cleanup__(x))) + #ifdef __GNUC__ #define GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) #endif // __GNUC__ @@ -685,103 +687,6 @@ static inline BITMAPX *bitmapX_create(uint32_t bits) { #define COMPRESSION_MAX_OVERHEAD 128 #define COMPRESSION_MAX_MSG_SIZE (COMPRESSION_MAX_CHUNK - COMPRESSION_MAX_OVERHEAD - 1) #define PLUGINSD_LINE_MAX (COMPRESSION_MAX_MSG_SIZE - 768) -int pluginsd_isspace(char c); -int config_isspace(char c); -int group_by_label_isspace(char c); - -extern bool isspace_map_pluginsd[256]; -extern bool isspace_map_config[256]; -extern bool isspace_map_group_by_label[256]; - -static inline size_t quoted_strings_splitter(char *str, char **words, size_t max_words, bool *isspace_map) { - char *s = str, quote = 0; - size_t i = 0; - - // skip all white space - while (unlikely(isspace_map[(uint8_t)*s])) - s++; - - if(unlikely(!*s)) { - words[i] = NULL; - return 0; - } - - // check for quote - if (unlikely(*s == '\'' || *s == '"')) { - quote = *s; // remember the quote - s++; // skip the quote - } - - // store the first word - words[i++] = s; - - // while we have something - while (likely(*s)) { - // if it is an escape - if (unlikely(*s == '\\' && s[1])) { - s += 2; - continue; - } - - // if it is a quote - else if (unlikely(*s == quote)) { - quote = 0; - *s = ' '; - continue; - } - - // if it is a space - else if (unlikely(quote == 0 && isspace_map[(uint8_t)*s])) { - // terminate the word - *s++ = '\0'; - - // skip all white space - while (likely(isspace_map[(uint8_t)*s])) - s++; - - // check for a quote - if (unlikely(*s == '\'' || *s == '"')) { - quote = *s; // remember the quote - s++; // skip the quote - } - - // if we reached the end, stop - if (unlikely(!*s)) - break; - - // store the next word - if (likely(i < max_words)) - words[i++] = s; - else - break; - } - - // anything else - else - s++; - } - - if (likely(i < max_words)) - words[i] = NULL; - - return i; -} - -#define quoted_strings_splitter_query_group_by_label(str, words, max_words) \ - quoted_strings_splitter(str, words, max_words, isspace_map_group_by_label) - -#define quoted_strings_splitter_config(str, words, max_words) \ - quoted_strings_splitter(str, words, max_words, isspace_map_config) - -#define quoted_strings_splitter_pluginsd(str, words, max_words) \ - quoted_strings_splitter(str, words, max_words, isspace_map_pluginsd) - -static inline char *get_word(char **words, size_t num_words, size_t index) { - if (unlikely(index >= num_words)) - return NULL; - - return words[index]; -} bool run_command_and_copy_output_to_stdout(const char *command, int max_line_length); @@ -803,6 +708,8 @@ extern char *netdata_configured_host_prefix; #define XXH_INLINE_ALL #include "xxhash.h" +#include "uuid/uuid.h" + #include "libjudy/src/Judy.h" #include "july/july.h" #include "os.h" @@ -812,7 +719,10 @@ extern char *netdata_configured_host_prefix; #include "circular_buffer/circular_buffer.h" #include "avl/avl.h" #include "inlined.h" +#include "line_splitter/line_splitter.h" #include "clocks/clocks.h" +#include "datetime/iso8601.h" +#include "datetime/rfc7231.h" #include "completion/completion.h" #include "popen/popen.h" #include "simple_pattern/simple_pattern.h" @@ -821,7 +731,9 @@ extern char *netdata_configured_host_prefix; #endif #include "socket/socket.h" #include "config/appconfig.h" +#include "log/journal.h" #include "log/log.h" +#include "buffered_reader/buffered_reader.h" #include "procfile/procfile.h" #include "string/string.h" #include "dictionary/dictionary.h" |