diff options
author | vkalintiris <vasilis@netdata.cloud> | 2022-10-09 16:38:49 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-09 16:38:49 +0300 |
commit | ccfbdb5c3d253a391cab0561dfc8a524b93d2e7c (patch) | |
tree | cf5e43618e40801db736604e5c8d4c4e6c0f9f65 /libnetdata | |
parent | 284d5450ec938b667db9985aca6d3cd02b96487f (diff) |
Remove extern from function declared in headers. (#13790)
By default functions are declared as extern in C/C++ headers. The goal
of this PR is to reduce the wall of text that many headers have and,
more importantly, to make the declaration of extern'd variables - of
which we have many dispersed in various places - easily and quickly
identifiable.
Automatically generated with:
$ git grep -l '^extern.*(' '**.h' | \
grep -v libjudy | \
grep -v 'sqlite3.h' | \
xargs sed -i -e 's/extern \(.*(.*$\)/\1/'
This is a NFC.
Diffstat (limited to 'libnetdata')
25 files changed, 370 insertions, 370 deletions
diff --git a/libnetdata/adaptive_resortable_list/adaptive_resortable_list.h b/libnetdata/adaptive_resortable_list/adaptive_resortable_list.h index 011ee73d98..294c52e81b 100644 --- a/libnetdata/adaptive_resortable_list/adaptive_resortable_list.h +++ b/libnetdata/adaptive_resortable_list/adaptive_resortable_list.h @@ -64,25 +64,25 @@ typedef struct arl_base { } ARL_BASE; // create a new ARL -extern ARL_BASE *arl_create(const char *name, void (*processor)(const char *, uint32_t, const char *, void *), size_t rechecks); +ARL_BASE *arl_create(const char *name, void (*processor)(const char *, uint32_t, const char *, void *), size_t rechecks); // free an ARL -extern void arl_free(ARL_BASE *arl_base); +void arl_free(ARL_BASE *arl_base); // register an expected keyword to the ARL // together with its destination ( i.e. the output of the processor() ) -extern ARL_ENTRY *arl_expect_custom(ARL_BASE *base, const char *keyword, void (*processor)(const char *name, uint32_t hash, const char *value, void *dst), void *dst); +ARL_ENTRY *arl_expect_custom(ARL_BASE *base, const char *keyword, void (*processor)(const char *name, uint32_t hash, const char *value, void *dst), void *dst); #define arl_expect(base, keyword, dst) arl_expect_custom(base, keyword, NULL, dst) // an internal call to complete the check() call -extern int arl_find_or_create_and_relink(ARL_BASE *base, const char *s, const char *value); +int arl_find_or_create_and_relink(ARL_BASE *base, const char *s, const char *value); // begin an ARL iteration -extern void arl_begin(ARL_BASE *base); +void arl_begin(ARL_BASE *base); -extern void arl_callback_str2ull(const char *name, uint32_t hash, const char *value, void *dst); -extern void arl_callback_str2kernel_uint_t(const char *name, uint32_t hash, const char *value, void *dst); -extern void arl_callback_ssize_t(const char *name, uint32_t hash, const char *value, void *dst); +void arl_callback_str2ull(const char *name, uint32_t hash, const char *value, void *dst); +void arl_callback_str2kernel_uint_t(const char *name, uint32_t hash, const char *value, void *dst); +void arl_callback_ssize_t(const char *name, uint32_t hash, const char *value, void *dst); // check a keyword against the ARL // this is to be called for each keyword read from source data diff --git a/libnetdata/arrayalloc/arrayalloc.h b/libnetdata/arrayalloc/arrayalloc.h index e0e9e7f9f5..d04c7c74a9 100644 --- a/libnetdata/arrayalloc/arrayalloc.h +++ b/libnetdata/arrayalloc/arrayalloc.h @@ -28,8 +28,8 @@ typedef struct arrayalloc { } internal; } ARAL; -extern ARAL *arrayalloc_create(size_t element_size, size_t elements, const char *filename, char **cache_dir); -extern void *arrayalloc_mallocz(ARAL *ar); -extern void arrayalloc_freez(ARAL *ar, void *ptr); +ARAL *arrayalloc_create(size_t element_size, size_t elements, const char *filename, char **cache_dir); +void *arrayalloc_mallocz(ARAL *ar); +void arrayalloc_freez(ARAL *ar, void *ptr); #endif // ARRAYALLOC_H diff --git a/libnetdata/buffer/buffer.h b/libnetdata/buffer/buffer.h index fe45b1c6d6..ce6f52899b 100644 --- a/libnetdata/buffer/buffer.h +++ b/libnetdata/buffer/buffer.h @@ -49,37 +49,37 @@ typedef struct web_buffer { #define buffer_no_cacheable(wb) do { (wb)->options |= WB_CONTENT_NO_CACHEABLE; if((wb)->options & WB_CONTENT_CACHEABLE) (wb)->options &= ~WB_CONTENT_CACHEABLE; (wb)->expires = 0; } while(0) #define buffer_strlen(wb) ((wb)->len) -extern const char *buffer_tostring(BUFFER *wb); +const char *buffer_tostring(BUFFER *wb); #define buffer_flush(wb) wb->buffer[(wb)->len = 0] = '\0' -extern void buffer_reset(BUFFER *wb); +void buffer_reset(BUFFER *wb); -extern void buffer_strcat(BUFFER *wb, const char *txt); -extern void buffer_fast_strcat(BUFFER *wb, const char *txt, size_t len); -extern void buffer_rrd_value(BUFFER *wb, NETDATA_DOUBLE value); +void buffer_strcat(BUFFER *wb, const char *txt); +void buffer_fast_strcat(BUFFER *wb, const char *txt, size_t len); +void buffer_rrd_value(BUFFER *wb, NETDATA_DOUBLE value); -extern void buffer_date(BUFFER *wb, int year, int month, int day, int hours, int minutes, int seconds); -extern void buffer_jsdate(BUFFER *wb, int year, int month, int day, int hours, int minutes, int seconds); +void buffer_date(BUFFER *wb, int year, int month, int day, int hours, int minutes, int seconds); +void buffer_jsdate(BUFFER *wb, int year, int month, int day, int hours, int minutes, int seconds); -extern BUFFER *buffer_create(size_t size); -extern void buffer_free(BUFFER *b); -extern void buffer_increase(BUFFER *b, size_t free_size_required); +BUFFER *buffer_create(size_t size); +void buffer_free(BUFFER *b); +void buffer_increase(BUFFER *b, size_t free_size_required); -extern void buffer_snprintf(BUFFER *wb, size_t len, const char *fmt, ...) PRINTFLIKE(3, 4); -extern void buffer_vsprintf(BUFFER *wb, const char *fmt, va_list args); -extern void buffer_sprintf(BUFFER *wb, const char *fmt, ...) PRINTFLIKE(2,3); -extern void buffer_strcat_jsonescape(BUFFER *wb, const char *txt); -extern void buffer_strcat_htmlescape(BUFFER *wb, const char *txt); +void buffer_snprintf(BUFFER *wb, size_t len, const char *fmt, ...) PRINTFLIKE(3, 4); +void buffer_vsprintf(BUFFER *wb, const char *fmt, va_list args); +void buffer_sprintf(BUFFER *wb, const char *fmt, ...) PRINTFLIKE(2,3); +void buffer_strcat_jsonescape(BUFFER *wb, const char *txt); +void buffer_strcat_htmlescape(BUFFER *wb, const char *txt); -extern void buffer_char_replace(BUFFER *wb, char from, char to); +void buffer_char_replace(BUFFER *wb, char from, char to); -extern char *print_number_lu_r(char *str, unsigned long uvalue); -extern char *print_number_llu_r(char *str, unsigned long long uvalue); -extern char *print_number_llu_r_smart(char *str, unsigned long long uvalue); +char *print_number_lu_r(char *str, unsigned long uvalue); +char *print_number_llu_r(char *str, unsigned long long uvalue); +char *print_number_llu_r_smart(char *str, unsigned long long uvalue); -extern void buffer_print_llu(BUFFER *wb, unsigned long long uvalue); -extern void buffer_print_ll(BUFFER *wb, long long value); -extern void buffer_print_llu_hex(BUFFER *wb, unsigned long long value); +void buffer_print_llu(BUFFER *wb, unsigned long long uvalue); +void buffer_print_ll(BUFFER *wb, long long value); +void buffer_print_llu_hex(BUFFER *wb, unsigned long long value); static inline void buffer_need_bytes(BUFFER *buffer, size_t needed_free_size) { if(unlikely(buffer->size - buffer->len < needed_free_size)) diff --git a/libnetdata/circular_buffer/circular_buffer.h b/libnetdata/circular_buffer/circular_buffer.h index ba3ddd9cd9..8c42aa807f 100644 --- a/libnetdata/circular_buffer/circular_buffer.h +++ b/libnetdata/circular_buffer/circular_buffer.h @@ -8,12 +8,12 @@ struct circular_buffer { char *data; }; -extern struct circular_buffer *cbuffer_new(size_t initial, size_t max); -extern void cbuffer_free(struct circular_buffer *buf); -extern int cbuffer_add_unsafe(struct circular_buffer *buf, const char *d, size_t d_len); -extern void cbuffer_remove_unsafe(struct circular_buffer *buf, size_t num); -extern size_t cbuffer_next_unsafe(struct circular_buffer *buf, char **start); -extern size_t cbuffer_available_size_unsafe(struct circular_buffer *buf); -extern void cbuffer_flush(struct circular_buffer*buf); +struct circular_buffer *cbuffer_new(size_t initial, size_t max); +void cbuffer_free(struct circular_buffer *buf); +int cbuffer_add_unsafe(struct circular_buffer *buf, const char *d, size_t d_len); +void cbuffer_remove_unsafe(struct circular_buffer *buf, size_t num); +size_t cbuffer_next_unsafe(struct circular_buffer *buf, char **start); +size_t cbuffer_available_size_unsafe(struct circular_buffer *buf); +void cbuffer_flush(struct circular_buffer*buf); #endif diff --git a/libnetdata/clocks/clocks.h b/libnetdata/clocks/clocks.h index 53c036ece9..7738a2c8ed 100644 --- a/libnetdata/clocks/clocks.h +++ b/libnetdata/clocks/clocks.h @@ -82,7 +82,7 @@ typedef struct heartbeat { * make systems without clock_gettime() support sensitive * to time jumps or hibernation/suspend side effects. */ -extern int clock_gettime(clockid_t clk_id, struct timespec *ts); +int clock_gettime(clockid_t clk_id, struct timespec *ts); #endif /* @@ -111,50 +111,50 @@ extern int clock_gettime(clockid_t clk_id, struct timespec *ts); * All now_*_usec() functions return the time in microseconds from the appropriate clock, or 0 on error. * */ -extern int now_realtime_timeval(struct timeval *tv); -extern time_t now_realtime_sec(void); -extern usec_t now_realtime_usec(void); +int now_realtime_timeval(struct timeval *tv); +time_t now_realtime_sec(void); +usec_t now_realtime_usec(void); -extern int now_monotonic_timeval(struct timeval *tv); -extern time_t now_monotonic_sec(void); -extern usec_t now_monotonic_usec(void); -extern int now_monotonic_high_precision_timeval(struct timeval *tv); -extern time_t now_monotonic_high_precision_sec(void); -extern usec_t now_monotonic_high_precision_usec(void); +int now_monotonic_timeval(struct timeval *tv); +time_t now_monotonic_sec(void); +usec_t now_monotonic_usec(void); +int now_monotonic_high_precision_timeval(struct timeval *tv); +time_t now_monotonic_high_precision_sec(void); +usec_t now_monotonic_high_precision_usec(void); -extern int now_boottime_timeval(struct timeval *tv); -extern time_t now_boottime_sec(void); -extern usec_t now_boottime_usec(void); +int now_boottime_timeval(struct timeval *tv); +time_t now_boottime_sec(void); +usec_t now_boottime_usec(void); -extern usec_t timeval_usec(struct timeval *tv); -extern msec_t timeval_msec(struct timeval *tv); +usec_t timeval_usec(struct timeval *tv); +msec_t timeval_msec(struct timeval *tv); -extern usec_t dt_usec(struct timeval *now, struct timeval *old); -extern susec_t dt_usec_signed(struct timeval *now, struct timeval *old); +usec_t dt_usec(struct timeval *now, struct timeval *old); +susec_t dt_usec_signed(struct timeval *now, struct timeval *old); -extern void heartbeat_init(heartbeat_t *hb); +void heartbeat_init(heartbeat_t *hb); /* Sleeps until next multiple of tick using monotonic clock. * Returns elapsed time in microseconds since previous heartbeat */ -extern usec_t heartbeat_next(heartbeat_t *hb, usec_t tick); +usec_t heartbeat_next(heartbeat_t *hb, usec_t tick); -extern void heartbeat_statistics(usec_t *min_ptr, usec_t *max_ptr, usec_t *average_ptr, size_t *count_ptr); +void heartbeat_statistics(usec_t *min_ptr, usec_t *max_ptr, usec_t *average_ptr, size_t *count_ptr); -extern void sleep_usec(usec_t usec); +void sleep_usec(usec_t usec); -extern void clocks_init(void); +void clocks_init(void); // lower level functions - avoid using directly -extern time_t now_sec(clockid_t clk_id); -extern usec_t now_usec(clockid_t clk_id); -extern int now_timeval(clockid_t clk_id, struct timeval *tv); +time_t now_sec(clockid_t clk_id); +usec_t now_usec(clockid_t clk_id); +int now_timeval(clockid_t clk_id, struct timeval *tv); -extern collected_number uptime_msec(char *filename); +collected_number uptime_msec(char *filename); extern usec_t clock_monotonic_resolution; extern usec_t clock_realtime_resolution; -extern void sleep_to_absolute_time(usec_t usec); +void sleep_to_absolute_time(usec_t usec); #endif /* NETDATA_CLOCKS_H */ diff --git a/libnetdata/config/appconfig.h b/libnetdata/config/appconfig.h index d72a3140e8..7707860ded 100644 --- a/libnetdata/config/appconfig.h +++ b/libnetdata/config/appconfig.h @@ -163,41 +163,41 @@ struct config { #define CONFIG_BOOLEAN_AUTO 2 // enabled if it has useful info when enabled #endif -extern int appconfig_load(struct config *root, char *filename, int overwrite_used, const char *section_name); -extern void config_section_wrlock(struct section *co); -extern void config_section_unlock(struct section *co); +int appconfig_load(struct config *root, char *filename, int overwrite_used, const char *section_name); +void config_section_wrlock(struct section *co); +void config_section_unlock(struct section *co); -extern char *appconfig_get_by_section(struct section *co, const char *name, const char *default_value); -extern char *appconfig_get(struct config *root, const char *section, const char *name, const char *default_value); -extern long long appconfig_get_number(struct config *root, const char *section, const char *name, long long value); -extern NETDATA_DOUBLE appconfig_get_float(struct config *root, const char *section, const char *name, NETDATA_DOUBLE value); -extern int appconfig_get_boolean_by_section(struct section *co, const char *name, int value); -extern int appconfig_get_boolean(struct config *root, const char *section, const char *name, int value); -extern int appconfig_get_boolean_ondemand(struct config *root, const char *section, const char *name, int value); -extern int appconfig_get_duration(struct config *root, const char *section, const char *name, const char *value); +char *appconfig_get_by_section(struct section *co, const char *name, const char *default_value); +char *appconfig_get(struct config *root, const char *section, const char *name, const char *default_value); +long long appconfig_get_number(struct config *root, const char *section, const char *name, long long value); +NETDATA_DOUBLE appconfig_get_float(struct config *root, const char *section, const char *name, NETDATA_DOUBLE value); +int appconfig_get_boolean_by_section(struct section *co, const char *name, int value); +int appconfig_get_boolean(struct config *root, const char *section, const char *name, int value); +int appconfig_get_boolean_ondemand(struct config *root, const char *section, const char *name, int value); +int appconfig_get_duration(struct config *root, const char *section, const char *name, const char *value); -extern const char *appconfig_set(struct config *root, const char *section, const char *name, const char *value); -extern const char *appconfig_set_default(struct config *root, const char *section, const char *name, const char *value); -extern long long appconfig_set_number(struct config *root, const char *section, const char *name, long long value); -extern NETDATA_DOUBLE appconfig_set_float(struct config *root, const char *section, const char *name, NETDATA_DOUBLE value); -extern int appconfig_set_boolean(struct config *root, const char *section, const char *name, int value); +const char *appconfig_set(struct config *root, const char *section, const char *name, const char *value); +const char *appconfig_set_default(struct config *root, const char *section, const char *name, const char *value); +long long appconfig_set_number(struct config *root, const char *section, const char *name, long long value); +NETDATA_DOUBLE appconfig_set_float(struct config *root, const char *section, const char *name, NETDATA_DOUBLE value); +int appconfig_set_boolean(struct config *root, const char *section, const char *name, int value); -extern int appconfig_exists(struct config *root, const char *section, const char *name); -extern int appconfig_move(struct config *root, const char *section_old, const char *name_old, const char *section_new, const char *name_new); +int appconfig_exists(struct config *root, const char *section, const char *name); +int appconfig_move(struct config *root, const char *section_old, const char *name_old, const char *section_new, const char *name_new); -extern void appconfig_generate(struct config *root, BUFFER *wb, int only_changed); +void appconfig_generate(struct config *root, BUFFER *wb, int only_changed); -extern int appconfig_section_compare(void *a, void *b); +int appconfig_section_compare(void *a, void *b); -extern void appconfig_section_destroy_non_loaded(struct config *root, const char *section); -extern void appconfig_section_option_destroy_non_loaded(struct config *root, const char *section, const char *name); +void appconfig_section_destroy_non_loaded(struct config *root, const char *section); +void appconfig_section_option_destroy_non_loaded(struct config *root, const char *section, const char *name); -extern int config_parse_duration(const char* string, int* result); +int config_parse_duration(const char* string, int* result); -extern struct section *appconfig_get_section(struct config *root, const char *name); +struct section *appconfig_get_section(struct config *root, const char *name); -extern void appconfig_wrlock(struct config *root); -extern void appconfig_unlock(struct config *root); +void appconfig_wrlock(struct config *root); +void appconfig_unlock(struct config *root); struct connector_instance { char instance_name[CONFIG_MAX_NAME + 1]; @@ -212,6 +212,6 @@ typedef struct _connector_instance { struct _connector_instance *next; // Next instance } _CONNECTOR_INSTANCE; -extern _CONNECTOR_INSTANCE *add_connector_instance(struct section *connector, struct section *instance); +_CONNECTOR_INSTANCE *add_connector_instance(struct section *connector, struct section *instance); #endif /* NETDATA_CONFIG_H */ diff --git a/libnetdata/dictionary/dictionary.h b/libnetdata/dictionary/dictionary.h index c51746dbff..d002385cb3 100644 --- a/libnetdata/dictionary/dictionary.h +++ b/libnetdata/dictionary/dictionary.h @@ -108,51 +108,51 @@ struct dictionary_stats { #ifdef NETDATA_INTERNAL_CHECKS #define dictionary_create(options) dictionary_create_advanced_with_trace(options, NULL, __FUNCTION__, __LINE__, __FILE__) #define dictionary_create_advanced(options, stats) dictionary_create_advanced_with_trace(options, stats, __FUNCTION__, __LINE__, __FILE__) -extern DICTIONARY *dictionary_create_advanced_with_trace(DICT_OPTIONS options, struct dictionary_stats *stats, const char *function, size_t line, const char *file); +DICTIONARY *dictionary_create_advanced_with_trace(DICT_OPTIONS options, struct dictionary_stats *stats, const char *function, size_t line, const char *file); #else #define dictionary_create(options) dictionary_create_advanced(options, NULL); -extern DICTIONARY *dictionary_create_advanced(DICT_OPTIONS options, struct dictionary_stats *stats); +DICTIONARY *dictionary_create_advanced(DICT_OPTIONS options, struct dictionary_stats *stats); #endif // Create a view on a dictionary #ifdef NETDATA_INTERNAL_CHECKS #define dictionary_create_view(master) dictionary_create_view_with_trace(master, __FUNCTION__, __LINE__, __FILE__) -extern DICTIONARY *dictionary_create_view_with_trace(DICTIONARY *master, const char *function, size_t line, const char *file); +DICTIONARY *dictionary_create_view_with_trace(DICTIONARY *master, const char *function, size_t line, const char *file); #else -extern DICTIONARY *dictionary_create_view(DICTIONARY *master); +DICTIONARY *dictionary_create_view(DICTIONARY *master); #endif // an insert callback to be called just after an item is added to the dictionary // this callback is called while the dictionary is write locked! -extern void dictionary_register_insert_callback(DICTIONARY *dict, void (*ins_callback)(const DICTIONARY_ITEM *item, void *value, void *data), void *data); +void dictionary_register_insert_callback(DICTIONARY *dict, void (*ins_callback)(const DICTIONARY_ITEM *item, void *value, void *data), void *data); // a delete callback to be called just before an item is deleted forever // this callback is called while the dictionary is write locked! -extern void dictionary_register_delete_callback(DICTIONARY *dict, void (*del_callback)(const DICTIONARY_ITEM *item, void *value, void *data), void *data); +void dictionary_register_delete_callback(DICTIONARY *dict, void (*del_callback)(const DICTIONARY_ITEM *item, void *value, void *data), void *data); // a merge callback to be called when DICT_OPTION_DONT_OVERWRITE_VALUE // and an item is already found in the dictionary - the dictionary does nothing else in this case // the old_value will remain in the dictionary - the new_value is ignored // The callback should return true if the value has been updated (it increases the dictionary version). -extern void dictionary_register_conflict_callback(DICTIONARY *dict, bool (*conflict_callback)(const DICTIONARY_ITEM *item, void *old_value, void *new_value, void *data), void *data); +void dictionary_register_conflict_callback(DICTIONARY *dict, bool (*conflict_callback)(const DICTIONARY_ITEM *item, void *old_value, void *new_value, void *data), void *data); // a reaction callback to be called after every item insertion or conflict // after the constructors have finished and the items are fully available for use // and the dictionary is not write locked anymore -extern void dictionary_register_react_callback(DICTIONARY *dict, void (*react_callback)(const DICTIONARY_ITEM *item, void *value, void *data), void *data); +void dictionary_register_react_callback(DICTIONARY *dict, void (*react_callback)(const DICTIONARY_ITEM *item, void *value, void *data), void *data); // Destroy a dictionary // Returns the number of bytes freed // The returned value will not include name/key sizes // Registered delete callbacks will be run for each item in the dictionary. -extern size_t dictionary_destroy(DICTIONARY *dict); +size_t dictionary_destroy(DICTIONARY *dict); // Empties a dictionary // Referenced items will survive, but are not offered anymore. // Registered delete callbacks will be run for each item in the dictionary. -extern void dictionary_flush(DICTIONARY *dict); +void dictionary_flush(DICTIONARY *dict); -extern void dictionary_version_increment(DICTIONARY *dict); +void dictionary_version_increment(DICTIONARY *dict); // ---------------------------------------------------------------------------- // Set an item in the dictionary @@ -171,26 +171,26 @@ extern void dictionary_version_increment(DICTIONARY *dict); // Passing NULL as value, the dictionary will callocz() the newly allocated value, otherwise it will copy it. // Passing 0 as value_len, the dictionary will set the value to NULL (no allocations for value will be made). #define dictionary_set(dict, name, value, value_len) dictionary_set_advanced(dict, name, -1, value, value_len, NULL) -extern void *dictionary_set_advanced(DICTIONARY *dict, const char *name, ssize_t name_len, void *value, size_t value_len, void *constructor_data); +void *dictionary_set_advanced(DICTIONARY *dict, const char *name, ssize_t name_len, void *value, size_t value_len, void *constructor_data); #define dictionary_set_and_acquire_item(dict, name, value, value_len) dictionary_set_and_acquire_item_advanced(dict, name, -1, value, value_len, NULL) -extern DICT_ITEM_CONST DICTIONARY_ITEM *dictionary_set_and_acquire_item_advanced(DICTIONARY *dict, const char *name, ssize_t name_len, void *value, size_t value_len, void *constructor_data); +DICT_ITEM_CONST DICTIONARY_ITEM *dictionary_set_and_acquire_item_advanced(DICTIONARY *dict, const char *name, ssize_t name_len, void *value, size_t value_len, void *constructor_data); // set an item in a dictionary view #define dictionary_view_set_and_acquire_item(dict, name, master_item) dictionary_view_set_and_acquire_item_advanced(dict, name, -1, master_item) -extern DICT_ITEM_CONST DICTIONARY_ITEM *dictionary_view_set_and_acquire_item_advanced(DICTIONARY *dict, const char *name, ssize_t name_len, DICTIONARY_ITEM *master_item); +DICT_ITEM_CONST DICTIONARY_ITEM *dictionary_view_set_and_acquire_item_advanced(DICTIONARY *dict, const char *name, ssize_t name_len, DICTIONARY_ITEM *master_item); #define dictionary_view_set(dict, name, master_item) dictionary_view_set_advanced(dict, name, -1, master_item) -extern void *dictionary_view_set_advanced(DICTIONARY *dict, const char *name, ssize_t name_len, DICT_ITEM_CONST DICTIONARY_ITEM *master_item); +void *dictionary_view_set_advanced(DICTIONARY *dict, const char *name, ssize_t name_len, DICT_ITEM_CONST DICTIONARY_ITEM *master_item); // ---------------------------------------------------------------------------- // Get an item from the dictionary // If it returns NULL, the item is not found #define dictionary_get(dict, name) dictionary_get_advanced(dict, name, -1) -extern void *dictionary_get_advanced(DICTIONARY *dict, const char *name, ssize_t name_len); +void *dictionary_get_advanced(DICTIONARY *dict, const char *name, ssize_t name_len); #define dictionary_get_and_acquire_item(dict, name) dictionary_get_and_acquire_item_advanced(dict, name, -1) -extern DICT_ITEM_CONST DICTIONARY_ITEM *dictionary_get_and_acquire_item_advanced(DICTIONARY *dict, const char *name, ssize_t name_len); +DICT_ITEM_CONST DICTIONARY_ITEM *dictionary_get_and_acquire_item_advanced(DICTIONARY *dict, const char *name, ssize_t name_len); // ---------------------------------------------------------------------------- @@ -199,19 +199,19 @@ extern DICT_ITEM_CONST DICTIONARY_ITEM *dictionary_get_and_acquire_item_advanced // returns false if the item was not found in the index #define dictionary_del(dict, name) dictionary_del_advanced(dict, name, -1) -extern bool dictionary_del_advanced(DICTIONARY *dict, const char *name, ssize_t name_len); +bool dictionary_del_advanced(DICTIONARY *dict, const char *name, ssize_t name_len); // ---------------------------------------------------------------------------- // reference counters management -extern void dictionary_acquired_item_release(DICTIONARY *dict, DICT_ITEM_CONST DICTIONARY_ITEM *item); +void dictionary_acquired_item_release(DICTIONARY *dict, DICT_ITEM_CONST DICTIONARY_ITEM *item); -extern DICT_ITEM_CONST DICTIONARY_ITEM *dictionary_acquired_item_dup(DICTIONARY *dict, DICT_ITEM_CONST DICTIONARY_ITEM *item); +DICT_ITEM_CONST DICTIONARY_ITEM *dictionary_acquired_item_dup(DICTIONARY *dict, DICT_ITEM_CONST DICTIONARY_ITEM *item); -extern const char *dictionary_acquired_item_name(DICT_ITEM_CONST DICTIONARY_ITEM *item); -extern void *dictionary_acquired_item_value(DICT_ITEM_CONST DICTIONARY_ITEM *item); +const char *dictionary_acquired_item_name(DICT_ITEM_CONST DICTIONARY_ITEM *item); +void *dictionary_acquired_item_value(DICT_ITEM_CONST DICTIONARY_ITEM *item); -extern size_t dictionary_acquired_item_references(DICT_ITEM_CONST DICTIONARY_ITEM *item); +size_t dictionary_acquired_item_references(DICT_ITEM_CONST DICTIONARY_ITEM *item); // ---------------------------------------------------------------------------- // Traverse (walk through) the items of the dictionary. @@ -228,7 +228,7 @@ extern size_t dictionary_acquired_item_references(DICT_ITEM_CONST DICTIONARY_ITE // #define dictionary_walkthrough_read(dict, callback, data) dictionary_walkthrough_rw(dict, 'r', callback, data) #define dictionary_walkthrough_write(dict, callback, data) dictionary_walkthrough_rw(dict, 'w', callback, data) -extern int dictionary_walkthrough_rw(DICTIONARY *dict, char rw, int (*callback)(const DICTIONARY_ITEM *item, void *value, void *data), void *data); +int dictionary_walkthrough_rw(DICTIONARY *dict, char rw, int (*callback)(const DICTIONARY_ITEM *item, void *value, void *data), void *data); #define dictionary_sorted_walkthrough_read(dict, callback, data) dictionary_sorted_walkthrough_rw(dict, 'r', callback, data) #define dictionary_sorted_walkthrough_write(dict, callback, data) dictionary_sorted_walkthrough_rw(dict, 'w', callback, data) @@ -253,8 +253,8 @@ int dictionary_sorted_walkthrough_rw(DICTIONARY *dict, char rw, int (*callback)( #define DICTIONARY_LOCK_WRITE 'w' #define DICTIONARY_LOCK_REENTRANT 'z' -extern void dictionary_write_lock(DICTIONARY *dict); -extern void dictionary_write_unlock(DICTIONARY *dict); +void dictionary_write_lock(DICTIONARY *dict); +void dictionary_write_unlock(DICTIONARY *dict); typedef DICTFE_CONST struct dictionary_foreach { DICTIONARY *dict; // the dictionary upon we work @@ -290,31 +290,31 @@ typedef DICTFE_CONST struct dictionary_foreach { dictionary_foreach_done(&value ## _dfe); \ } while(0) -extern void *dictionary_foreach_start_rw(DICTFE *dfe, DICTIONARY *dict, char rw); -extern void *dictionary_foreach_next(DICTFE *dfe); -extern void dictionary_foreach_done(DICTFE *dfe); +void *dictionary_foreach_start_rw(DICTFE *dfe, DICTIONARY *dict, char rw); +void *dictionary_foreach_next(DICTFE *dfe); +void dictionary_foreach_done(DICTFE *dfe); // ---------------------------------------------------------------------------- // Get statistics about the dictionary -extern size_t dictionary_version(DICTIONARY *dict); -extern size_t dictionary_entries(DICTIONARY *dict); -extern size_t dictionary_referenced_items(DICTIONARY *dict); -extern long int dictionary_stats_for_registry(DICTIONARY *dict); +size_t dictionary_version(DICTIONARY *dict); +size_t dictionary_entries(DICTIONARY *dict); +size_t dictionary_referenced_items(DICTIONARY *dict); +long int dictionary_stats_for_registry(DICTIONARY *dict); // for all cases that the caller does not provide a stats structure, this is where they are accumulated. extern struct dictionary_stats dictionary_stats_category_other; -extern int dictionary_unittest(size_t entries); +int dictionary_unittest(size_t entries); // ---------------------------------------------------------------------------- // THREAD CACHE -extern void *thread_cache_entry_get_or_set(void *key, +void *thread_cache_entry_get_or_set(void *key, ssize_t key_length, void *value, void *(*transform_the_value_before_insert)(void *key, size_t key_length, void *value)); -extern void thread_cache_destroy(void); +void thread_cache_destroy(void); #endif /* NETDATA_DICTIONARY_H */ diff --git a/libnetdata/ebpf/ebpf.h b/libnetdata/ebpf/ebpf.h index 280fde6288..ee01277239 100644 --- a/libnetdata/ebpf/ebpf.h +++ b/libnetdata/ebpf/ebpf.h @@ -270,25 +270,25 @@ typedef struct ebpf_module { struct bpf_object *objects; } ebpf_module_t; -extern int ebpf_get_kernel_version(); -extern int get_redhat_release(); -extern int has_condition_to_run(int version); -extern char *ebpf_kernel_suffix(int version, int isrh); -extern struct bpf_link **ebpf_load_program(char *plugins_dir, ebpf_module_t *em, int kver, int is_rhf, +int ebpf_get_kernel_version(); +int get_redhat_release(); +int has_condition_to_run(int version); +char *ebpf_kernel_suffix(int version, int isrh); +struct bpf_link **ebpf_load_program(char *plugins_dir, ebpf_module_t *em, int kver, int is_rhf, struct bpf_object **obj); -extern void ebpf_mount_config_name(char *filename, size_t length, char *path, const char *config); -extern int ebpf_load_config(struct config *config, char *filename); -extern void ebpf_update_module(ebpf_module_t *em, struct btf *btf_file); -extern void ebpf_update_names(ebpf_specify_name_t *opt, ebpf_module_t *em); -extern void ebpf_adjust_apps_cgroup(ebpf_module_t *em, netdata_ebpf_program_loaded_t mode); -extern char *ebpf_find_symbol(char *search); -extern void ebpf_load_addresses(ebpf_addresses_t *fa, int fd); -extern void ebpf_fill_algorithms(int *algorithms, size_t length, int algorithm); -extern char **ebpf_fill_histogram_dimension(size_t maximum); -extern void ebpf_update_stats(ebpf_plugin_stats_t *report, ebpf_module_t *em); -extern void ebpf_update_controller(int fd, ebpf_module_t *em); -extern void ebpf_update_map_size(struct bpf_map *map, ebpf_local_maps_t *lmap, ebpf_module_t *em, const char *map_name); +void ebpf_mount_config_name(char *filename, size_t length, char *path, const char *config); +int ebpf_load_config(struct config *config, char *filename); +void ebpf_update_module(ebpf_module_t *em, struct btf *btf_file); +void ebpf_update_names(ebpf_specify_name_t *opt, ebpf_module_t *em); +void ebpf_adjust_apps_cgroup(ebpf_module_t *em, netdata_ebpf_program_loaded_t mode); +char *ebpf_find_symbol(char *search); +void ebpf_load_addresses(ebpf_addresses_t *fa, int fd); +void ebpf_fill_algorithms(int *algorithms, size_t length, int algorithm); +char **ebpf_fill_histogram_dimension(size_t maximum); +void ebpf_update_stats(ebpf_plugin_stats_t *report, ebpf_module_t *em); +void ebpf_update_controller(int fd, ebpf_module_t *em); +void ebpf_update_map_size(struct bpf_map *map, ebpf_local_maps_t *lmap, ebpf_module_t *em, const char *map_name); // Histogram #define NETDATA_EBPF_HIST_MAX_BINS 24UL @@ -339,13 +339,13 @@ typedef struct ebpf_sync_syscalls { #endif } ebpf_sync_syscalls_t; -extern void ebpf_histogram_dimension_cleanup(char **ptr, size_t length); +void ebpf_histogram_dimension_cleanup(char **ptr, size_t length); // Tracepoint helpers // For more information related to tracepoints read https://www.kernel.org/doc/html/latest/trace/tracepoints.html -extern int ebpf_is_tracepoint_enabled(char *subsys, char *eventname); -extern int ebpf_enable_tracing_values(char *subsys, char *eventname); -extern int ebpf_disable_tracing_values(char *subsys, char *eventname); +int ebpf_is_tracepoint_enabled(char *subsys, char *eventname); +int ebpf_enable_tracing_values(char *subsys, char *eventname); +int ebpf_disable_tracing_values(char *subsys, char *eventname); // BTF Section #define EBPF_DEFAULT_BTF_FILE "vmlinux" @@ -355,14 +355,14 @@ extern int ebpf_disable_tracing_values(char *subsys, char *eventname); // BTF helpers #define NETDATA_EBPF_MAX_SYSCALL_LENGTH 255 -extern netdata_ebpf_load_mode_t epbf_convert_string_to_load_mode(char *str); -extern netdata_ebpf_program_loaded_t ebpf_convert_core_type(char *str, netdata_run_mode_t lmode); -extern void ebpf_select_host_prefix(char *output, size_t length, char *syscall, int kver); +netdata_ebpf_load_mode_t epbf_convert_string_to_load_mode(char *str); +netdata_ebpf_program_loaded_t ebpf_convert_core_type(char *str, netdata_run_mode_t lmode); +void ebpf_select_host_prefix(char *output, size_t length, char *syscall, int kver); #ifdef LIBBPF_MAJOR_VERSION -extern void ebpf_adjust_thread_load(ebpf_module_t *mod, struct btf *file); -extern struct btf *ebpf_parse_btf_file(const char *filename); -extern struct btf *ebpf_load_btf_file(char *path, char *filename); -extern int ebpf_is_function_inside_btf(struct btf *file, char *function); +void ebpf_adjust_thread_load(ebpf_module_t *mod, struct btf *file); +struct btf *ebpf_parse_btf_file(const char *filename); +struct btf *ebpf_load_btf_file(char *path, char *filename); +int ebpf_is_function_inside_btf(struct btf *file, char *function); #endif #endif /* NETDATA_EBPF_H */ diff --git a/libnetdata/eval/eval.h b/libnetdata/eval/eval.h index b3c13d193d..1633ec505f 100644 --- a/libnetdata/eval/eval.h +++ b/libnetdata/eval/eval.h @@ -69,19 +69,19 @@ typedef struct eval_expression { // parse the given string as an expression and return: // a pointer to an expression if it parsed OK // NULL in which case the pointer to error has the error code -extern EVAL_EXPRESSION *expression_parse(const char *string, const char **failed_at, int *error); +EVAL_EXPRESSION *expression_parse(const char *string, const char **failed_at, int *error); // free all resources allocated for an expression -extern void expression_free(EVAL_EXPRESSION *expression); +void expression_free(EVAL_EXPRESSION *expression); // convert an error code to a message -extern const char *expression_strerror(int error); +const char *expression_strerror(int error); // evaluate an expression and return // 1 = OK, the result is in: expression->result // 2 = FAILED, the error message is in: buffer_tostring(expression->error_msg) -extern int expression_evaluate(EVAL_EXPRESSION *expression); +int expression_evaluate(EVAL_EXPRESSION *expression); -extern int health_variable_lookup(STRING *variable, struct rrdcalc *rc, NETDATA_DOUBLE *result); +int health_variable_lookup(STRING *variable, struct rrdcalc *rc, NETDATA_DOUBLE *result); #endif //NETDATA_EVAL_H diff --git a/libnetdata/health/health.h b/libnetdata/health/health.h index f7580edab2..6b8f9b3847 100644 --- a/libnetdata/health/health.h +++ b/libnetdata/health/health.h @@ -46,10 +46,10 @@ typedef struct silencers { extern SILENCERS *silencers; -extern SILENCER *create_silencer(void); -extern int health_silencers_json_read_callback(JSON_ENTRY *e); -extern void health_silencers_add(SILENCER *silencer); -extern SILENCER * health_silencers_addparam(SILENCER *silencer, char *key, char *value); -extern int health_initialize_global_silencers(); +SILENCER *create_silencer(void); +int health_silencers_json_read_callback(JSON_ENTRY *e); +void health_silencers_add(SILENCER *silencer); +SILENCER * health_silencers_addparam(SILENCER *silencer, char *key, char *value); +int health_initialize_global_silencers(); #endif diff --git a/libnetdata/libnetdata.h b/libnetdata/libnetdata.h index 2b60b5366b..d2bffec648 100644 --- a/libnetdata/libnetdata.h +++ b/libnetdata/libnetdata.h @@ -284,16 +284,16 @@ extern "C" { // --------------------------------------------------------------------------------------------- -extern void netdata_fix_chart_id(char *s); -extern void netdata_fix_chart_name(char *s); +void netdata_fix_chart_id(char *s); +void netdata_fix_chart_name(char *s); -extern void strreverse(char* begin, char* end); -extern char *mystrsep(char **ptr, char *s); -extern char *trim(char *s); // remove leading and trailing spaces; may return NULL -extern char *trim_all(char *buffer); // like trim(), but also remove duplicate spaces inside the string; may return NULL +void strreverse(char* begin, char* end); +char *mystrsep(char **ptr, char *s); +char *trim(char *s); // remove leading and trailing spaces; may return NULL +char *trim_all(char *buffer); // like trim(), but also remove duplicate spaces inside the string; may return NULL -extern int vsnprintfz(char *dst, size_t n, const char *fmt, va_list args); -extern int snprintfz(char *dst, size_t n, const char *fmt, ...) PRINTFLIKE(3, 4); +int vsnprintfz(char *dst, size_t n, const char *fmt, va_list args); +int snprintfz(char *dst, size_t n, const char *fmt, ...) PRINTFLIKE(3, 4); // memory allocation functions that handle failures #ifdef NETDATA_LOG_ALLOCATIONS @@ -305,47 +305,47 @@ extern __thread size_t log_thread_memory_allocations; #define freez(ptr) freez_int(__FILE__, __FUNCTION__, __LINE__, ptr) #define log_allocations() log_allocations_int(__FILE__, __FUNCTION__, __LINE__) -extern char *strdupz_int(const char *file, const char *function, const unsigned long line, const char *s); -extern void *callocz_int(const char *file, const char *function, const unsigned long line, size_t nmemb, size_t size); -extern void *mallocz_int(const char *file, const char *function, const unsigned long line, size_t size); -extern void *reallocz_int(const char *file, const char *function, const unsigned long line, void *ptr, size_t size); -extern void freez_int(const char *file, const char *function, const unsigned long line, void *ptr); -extern void log_allocations_int(const char *file, const char *function, const unsigned long line); +char *strdupz_int(const char *file, const char *function, const unsigned long line, const char *s); +void *callocz_int(const char *file, const char *function, const unsigned long line, size_t nmemb, size_t size); +void *mallocz_int(const char *file, const char *function, const unsigned long line, size_t size); +void *reallocz_int(const char *file, const char *function, const unsigned long line, void *ptr, size_t size); +void freez_int(const char *file, const char *function, const unsigned long line, void *ptr); +void log_allocations_int(const char *file, const char *function, const unsigned long line); #else // NETDATA_LOG_ALLOCATIONS -extern char *strdupz(const char *s) MALLOCLIKE NEVERNULL; -extern void *callocz(size_t nmemb, size_t size) MALLOCLIKE NEVERNULL; -extern void *mallocz(size_t size) MALLOCLIKE NEVERNULL; -extern void *reallocz(void *ptr, size_t size) MALLOCLIKE NEVERNULL; -extern void freez(void *ptr); +char *strdupz(const char *s) MALLOCLIKE NEVERNULL; +void *callocz(size_t nmemb, size_t size) MALLOCLIKE NEVERNULL; +void *mallocz(size_t size) MALLOCLIKE NEVERNULL; +void *reallocz(void *ptr, size_t size) MALLOCLIKE NEVERNULL; +void freez(void *ptr); #endif // NETDATA_LOG_ALLOCATIONS -extern void json_escape_string(char *dst, const char *src, size_t size); -extern void json_fix_string(char *s); +void json_escape_string(char *dst, const char *src, size_t size); +void json_fix_string(char *s); -extern void *netdata_mmap(const char *filename, size_t size, int flags, int ksm); -extern int memory_file_save(const char *filename, void *mem, size_t size); +void *netdata_mmap(const char *filename, size_t size, int flags, int ksm); +int memory_file_save(const char *filename, void *mem, size_t size); -extern int fd_is_valid(int fd); +int fd_is_valid(int fd); extern struct rlimit rlimit_nofile; extern int enable_ksm; -extern char *fgets_trim_len(char *buf, size_t buf_size, FILE *fp, size_t *len); +char *fgets_trim_len(char *buf, size_t buf_size, FILE *fp, size_t *len); -extern int verify_netdata_host_prefix(); +int verify_netdata_host_prefix(); -extern int recursively_delete_dir(const char *path, const char *reason); +int recursively_delete_dir(const char *path, const char *reason); extern volatile sig_atomic_t netdata_exit; extern const char *program_version; -extern char *strdupz_path_subpath(const char *path, const char *subpath); -extern int path_is_dir(const char *path, const char *subpath); -extern int path_is_file(const char *path, const char *subpath); -extern void recursive_config_double_dir_load( +char *strdupz_path_subpath(const char *path, const char *subpath); +int path_is_dir(const char *path, const char *subpath); +int path_is_file(const char *path, const char *subpath); +void recursive_config_double_dir_load( const char *user_path , const char *stock_path , const char *subpath @@ -353,8 +353,8 @@ extern void recursive_config_double_dir_load( , void *data , size_t depth ); -extern char *read_by_filename(char *filename, long *file_size); -extern char *find_and_replace(const char *src, const char *find, const char *replace, const char *where); +char *read_by_filename(char *filename, long *file_size); +char *find_and_replace(const char *src, const char *find, const char *replace, const char *where); /* fix for alpine linux */ #ifndef RUSAGE_THREAD @@ -385,20 +385,20 @@ typedef struct bitmap256 { uint64_t data[4]; } BITMAP256; -extern bool bitmap256_get_bit(BITMAP256 *ptr, uint8_t idx); -extern void bitmap256_set_bit(BITMAP256 *ptr, uint8_t idx, bool value); +bool bitmap256_get_bit(BITMAP256 *ptr, uint8_t idx); +void bitmap256_set_bit(BITMAP256 *ptr, uint8_t idx, bool value); #define COMPRESSION_MAX_MSG_SIZE 0x4000 #define PLUGINSD_LINE_MAX (COMPRESSION_MAX_MSG_SIZE - 1024) -extern int config_isspace(char c); -extern int pluginsd_space(char c); +int config_isspace(char c); +int pluginsd_space(char c); int quoted_strings_splitter(char *str, char **words, int max_words, int (*custom_isspace)(char), char *recover_input, char **recover_location, int max_recover); -extern int pluginsd_split_words(char *str, char **words, int max_words, char *recover_string, char **recover_location, int max_recover); +int pluginsd_split_words(char *str, char **words, int max_words, char *recover_string, char **recover_location, int max_recover); -extern bool run_command_and_copy_output_to_stdout(const char *command, int max_line_length); +bool run_command_and_copy_output_to_stdout(const char *command, int max_line_length); -extern void netdata_cleanup_and_exit(int ret) NORETURN; -extern void send_statistics(const char *action, const char *action_result, const char *action_data); +void netdata_cleanup_and_exit(int ret) NORETURN; +void send_statistics(const char *action, const char *action_result, const char *action_data); extern char *netdata_configured_host_prefix; #include "os.h" #include "storage_number/storage_number.h" diff --git a/libnetdata/locks/locks.h b/libnetdata/locks/locks.h index 796b53c6d7..a3aa421b9a 100644 --- a/libnetdata/locks/locks.h +++ b/libnetdata/locks/locks.h @@ -51,38 +51,38 @@ typedef struct netdata_rwlock_t { #endif // NETDATA_TRACE_RWLOCKS -extern int __netdata_mutex_init(netdata_mutex_t *mutex); -extern int __netdata_mutex_destroy(netdata_mutex_t *mutex); -extern int __netdata_mutex_lock(netdata_mutex_t *mutex); -extern int __netdata_mutex_trylock(netdata_mutex_t *mutex); -extern int __netdata_mutex_unlock(netdata_mutex_t *mutex); - -extern int __netdata_rwlock_destroy(netdata_rwlock_t *rwlock); -extern int __netdata_rwlock_init(netdata_rwlock_t *rwlock); -extern int __netdata_rwlock_rdlock(netdata_rwlock_t *rwlock); -extern int __netdata_rwlock_wrlock(netdata_rwlock_t *rwlock); -extern int __netdata_rwlock_unlock(netdata_rwlock_t *rwlock); -extern int __netdata_rwlock_tryrdlock(netdata_rwlock_t *rwlock); -extern int __netdata_rwlock_trywrlock(netdata_rwlock_t *rwlock); - -extern void netdata_thread_disable_cancelability(void); -extern void netdata_thread_enable_cancelability(void); +int __netdata_mutex_init(netdata_mutex_t *mutex); +int __netdata_mutex_destroy(netdata_mutex_t *mutex); +int __netdata_mutex_lock(netdata_mutex_t *mutex); +int __netdata_mutex_trylock(netdata_mutex_t *mutex); +int __netdata_mutex_unlock(netdata_mutex_t *mutex); + +int __netdata_rwlock_destroy(netdata_rwlock_t *rwlock); +int __netdata_rwlock_init(netdata_rwlock_t *rwlock); +int __netdata_rwlock_rdlock(netdata_rwlock_t *rwlock); +int __netdata_rwlock_wrlock(netdata_rwlock_t *rwlock); +int __netdata_rwlock_unlock(netdata_rwlock_t *rwlock); +int __netdata_rwlock_tryrdlock(netdata_rwlock_t *rwlock); +int __netdata_rwlock_trywrlock(netdata_rwlock_t *rwlock); + +void netdata_thread_disable_cancelability(void); +void netdata_thread_enable_cancelability(void); #ifdef NETDATA_TRACE_RWLOCKS -extern int netdata_mutex_init_debug( const char *file, const char *function, const unsigned long line, netdata_mutex_t *mutex); -extern int netdata_mutex_destroy_debug( const char *file, const char *function, const unsigned long line, netdata_mutex_t *mutex); -extern int netdata_mutex_lock_debug( const char *file, const char *function, const unsigned long line, netdata_mutex_t *mutex); -extern int netdata_mutex_trylock_debug( const char *file, const char *function, const unsigned long line, netdata_mutex_t *mutex); -extern int netdata_mutex_unlock_debug( const char *file, const char *function, const unsigned long line, netdata_mutex_t *mutex); - -extern int netdata_rwlock_destroy_debug( const char *file, const char *function, const unsigned long line, netdata_rwlock_t *rwlock); -extern int netdata_rwlock_init_debug( const char *file, const char *function, const unsigned long line, netdata_rwlock_t *rwlock); -extern int netdata_rwlock_rdlock_debug( const char *file, const char *function, const unsigned long line, netdata_rwlock_t *rwlock); -extern int netdata_rwlock_wrlock_debug( const char *file, const char *function, const unsigned long line, netdata_rwlock_t *rwlock); -extern int netdata_rwlock_unlock_debug( const char *file, const char *function, const unsigned long line, netdata_rwlock_t *rwlock); -extern int netdata_rwlock_tryrdlock_debug( const char *file, const char *function, const unsigned long line, netdata_rwlock_t *rwlock); -extern int netdata_rwlock_trywrlock_debug( const char *file, const char *function, const unsigned long line, netdata_rwlock_t *rwlock); +int netdata_mutex_init_debug( const char *file, const char *function, const unsigned long line, netdata_mutex_t *mutex); +int netdata_mutex_destroy_debug( const char *file, const char *function, const unsigned long line, netdata_mutex_t *mutex); +int netdata_mutex_lock_debug( const char *file, const char *function, const unsigned long line, netdata_mutex_t *mutex); +int netdata_mutex_trylock_debug( const char *file, const char *function, const unsigned long line, netdata_mutex_t *mutex); +int netdata_mutex_unlock_debug( const char *file, const char *function, const unsigned long line, netdata_mutex_t *mutex); + +int netdata_rwlock_destroy_debug( const char *file, const char *function, const unsigned long line, netdata_rwlock_t *rwlock); +int netdata_rwlock_init_debug( const char *file, const char *function, const unsigned long line, netdata_rwlock_t *rwlock); +int netdata_rwlock_rdlock_debug( const char *file, const char *function, const unsigned long line, netdata_rwlock_t *rwlock); +int netdata_rwlock_wrlock_debug( const char *file, const char *function, const unsigned long line, netdata_rwlock_t *rwlock); +int netdata_rwlock_unlock_debug( const char *file, const char *function, const unsigned long line, netdata_rwlock_t *rwlock); +int netdata_rwlock_tryrdlock_debug( const char *file, const char *function, const unsigned long line, netdata_rwlock_t *rwlock); +int netdata_rwlock_trywrlock_debug( const char *file, const char *function, const unsigned long line, netdata_rwlock_t *rwlock); #define netdata_mutex_init(mutex) netdata_mutex_init_debug(__FILE__, __FUNCTION__, __LINE__, mutex) #define netdata_mutex_destroy(mutex) netdata_mutex_init_debug(__FILE__, __FUNCTION__, __LINE__, mutex) diff --git a/libnetdata/log/log.h b/libnetdata/log/log.h index ae86720cbb..9391870d44 100644 --- a/libnetdata/log/log.h +++ b/libnetdata/log/log.h @@ -74,10 +74,10 @@ extern int output_log_syslog; extern time_t error_log_throttle_period; extern unsigned long error_log_errors_per_period, error_log_errors_per_period_backup; -extern int error_log_limit(int reset); +int error_log_limit(int reset); -extern void open_all_log_files(); -extern void reopen_all_log_files(); +void open_all_log_files(); +void reopen_all_log_files(); static inline void debug_dummy(void) {} @@ -98,15 +98,15 @@ void error_log_limit_unlimited(void); #define fatal(args...) fatal_int(__FILE__, __FUNCTION__, __LINE__, ##args) #define fatal_assert(expr) ((expr) ? (void)(0) : fatal_int(__FILE__, __FUNCTION__, __LINE__, "Assertion `%s' failed", #expr)) -extern void send_statistics(const char *action, const char *action_result, const char *action_data); -extern void debug_int( const char *file, const char *function, const unsigned long line, const char *fmt, ... ) PRINTFLIKE(4, 5); -extern void info_int( const char *file, const char *function, const unsigned long line, const char *fmt, ... ) PRINTFLIKE(4, 5); -extern void error_int( const char *prefix, const char *file, const char *function, const unsigned long line, const char *fmt, ... ) PRINTFLIKE(5, 6); -extern void fatal_int( const char *file, const char *function, const unsigned long line, const char *fmt, ... ) NORETURN PRINTFLIKE(4, 5); -extern void log_access( const char *fmt, ... ) PRINTFLIKE(1, 2); +void send_statistics(const char *action, const char *action_result, const char *action_data); +void debug_int( const char *file, const char *function, const unsigned long line, const char *fmt, ... ) PRINTFLIKE(4, 5); +void info_int( const char *file, const char *function, const unsigned long line, const char *fmt, ... ) PRINTFLIKE(4, 5); +void error_int( const char *prefix, const char *file, const char *function, const unsigned long line, const char *fmt, ... ) PRINTFLIKE(5, 6); +void fatal_int( const char *file, const char *function, const unsigned long line, const char *fmt, ... ) NORETURN PRINTFLIKE(4, 5); +void log_access( const char *fmt, ... ) PRINTFLIKE(1, 2); #ifdef ENABLE_ACLK -extern void log_aclk_message_bin( const char *data, const size_t data_len, int tx, const char *mqtt_topic, const char *message_name); +void log_aclk_message_bin( const char *data, const size_t data_len, int tx, const char *mqtt_topic, const char *message_name); #endif # ifdef __cplusplus diff --git a/libnetdata/onewayalloc/onewayalloc.h b/libnetdata/onewayalloc/onewayalloc.h index 9eb908bfb6..e536e0542e 100644 --- a/libnetdata/onewayalloc/onewayalloc.h +++ b/libnetdata/onewayalloc/onewayalloc.h @@ -5,15 +5,15 @@ typedef void ONEWAYALLOC; -extern ONEWAYALLOC *onewayalloc_create(size_t size_hint); -extern void onewayalloc_destroy(ONEWAYALLOC *owa); +ONEWAYALLOC *onewayalloc_create(size_t size_hint); +void onewayalloc_destroy(ONEWAYALLOC *owa); -extern void *onewayalloc_mallocz(ONEWAYALLOC *owa, size_t size); -extern void *onewayalloc_callocz(ONEWAYALLOC *owa, size_t nmemb, size_t size); -extern char *onewayalloc_strdupz(ONEWAYALLOC *owa, const char *s); -extern void *onewayalloc_memdupz(ONEWAYALLOC *owa, const void *src, size_t size); -extern void onewayalloc_freez(ONEWAYALLOC *owa, const void *ptr); +void *onewayalloc_mallocz(ONEWAYALLOC *owa, size_t size); +void *onewayalloc_callocz(ONEWAYALLOC *owa, size_t nmemb, size_t size); +char *onewayalloc_strdupz(ONEWAYALLOC *owa, const char *s); +void *onewayalloc_memdupz(ONEWAYALLOC *owa, const void *src, size_t size); +void onewayalloc_freez(ONEWAYALLOC *owa, const void *ptr); -extern void *onewayalloc_doublesize(ONEWAYALLOC *owa, const void *src, size_t oldsize); +void *onewayalloc_doublesize(ONEWAYALLOC *owa, const void *src, size_t oldsize); #endif // ONEWAYALLOC_H diff --git a/libnetdata/os.h b/libnetdata/os.h index 5e7746df89..67abf0be45 100644 --- a/libnetdata/os.h +++ b/libnetdata/os.h @@ -13,21 +13,21 @@ #include <sys/sysctl.h> #define GETSYSCTL_BY_NAME(name, var) getsysctl_by_name(name, &(var), sizeof(var)) -extern int getsysctl_by_name(const char *name, void *ptr, size_t len); +int getsysctl_by_name(const char *name, void *ptr, size_t len); #define GETSYSCTL_MIB(name, mib) getsysctl_mib(name, mib, sizeof(mib)/sizeof(int)) -extern int getsysctl_mib(const char *name, int *mib, size_t len); +int getsysctl_mib(const char *name, int *mib, size_t len); #define GETSYSCTL_SIMPLE(name, mib, var) getsysctl_simple(name, mib, sizeof(mib)/sizeof(int), &(var), sizeof(var)) #define GETSYSCTL_WSIZE(name, mib, var, size) getsysctl_simple(name, mib, sizeof(mib)/sizeof(int), var, size) -extern int getsysctl_simple(const char *name, int *mib, size_t miblen, void *ptr, size_t len); +int getsysctl_simple(const char *name, int *mib, size_t miblen, void *ptr, size_t len); #define GETSYSCTL_SIZE(name, mib, size) getsysctl(name, mib, sizeof(mib)/sizeof(int), NULL, &(size)) #define GETSYSCTL(name, mib, var, size) getsysctl(name, mib, sizeof(mib)/sizeof(int), &(var), &(size)) -extern int getsysctl(const char *name, int *mib, size_t miblen, void *ptr, size_t *len); +int getsysctl(const char *name, int *mib, size_t miblen, void *ptr, size_t *len); #endif @@ -39,7 +39,7 @@ extern int getsysctl(const char *name, int *mib, size_t miblen, void *ptr, size_ #include <sys/sysctl.h> #define GETSYSCTL_BY_NAME(name, var) getsysctl_by_name(name, &(var), sizeof(var)) -extern int getsysctl_by_name(const char *name, void *ptr, size_t len); +int getsysctl_by_name(const char *name, void *ptr, size_t len); #endif @@ -49,13 +49,13 @@ extern int getsysctl_by_name(const char *name, void *ptr, size_t len); extern const char *os_type; extern int processors; -extern long get_system_cpus(void); +long get_system_cpus(void); extern pid_t pid_max; -extern pid_t get_system_pid_max(void); +pid_t get_system_pid_max(void); extern unsigned int system_hz; -extern void get_system_HZ(void); +void get_system_HZ(void); #include <sys/timex.h> #if defined(__FreeBSD__) || defined(__APPLE__) diff --git a/libnetdata/popen/popen.h b/libnetdata/popen/popen.h index a0cf5f101f..c57a35a4e3 100644 --- a/libnetdata/popen/popen.h +++ b/libnetdata/popen/popen.h @@ -22,19 +22,19 @@ #define netdata_popen_raw_default_flags(pidptr, env, fpp_child_input, fpp_child_output, command, args...) netdata_popene_variadic_internal_dont_use_directly(pidptr, env, POPEN_FLAGS_DEFAULT, fpp_child_input, fpp_child_output, command, command, ##args, NULL) #define netdata_popen_raw(pidptr, env, flags, fpp_child_input, fpp_child_output, command, args...) netdata_popene_variadic_internal_dont_use_directly(pidptr, env, flags, fpp_child_input, fpp_child_output, command, command, ##args, NULL) -extern FILE *netdata_popen(const char *command, volatile pid_t *pidptr, FILE **fp_child_input); -extern FILE *netdata_popene(const char *command, volatile pid_t *pidptr, char **env, FILE **fp_child_input); -extern int netdata_popene_variadic_internal_dont_use_directly(volatile pid_t *pidptr, char **env, uint8_t flags, FILE **fpp_child_input, FILE **fpp_child_output, const char *command, ...); -extern int netdata_pclose(FILE *fp_child_input, FILE *fp_child_output, pid_t pid); +FILE *netdata_popen(const char *command, volatile pid_t *pidptr, FILE **fp_child_input); +FILE *netdata_popene(const char *command, volatile pid_t *pidptr, char **env, FILE **fp_child_input); +int netdata_popene_variadic_internal_dont_use_directly(volatile pid_t *pidptr, char **env, uint8_t flags, FILE **fpp_child_input, FILE **fpp_child_output, const char *command, ...); +int netdata_pclose(FILE *fp_child_input, FILE *fp_child_output, pid_t pid); -extern int netdata_spawn(const char *command, volatile pid_t *pidptr); -extern int netdata_spawn_waitpid(pid_t pid); +int netdata_spawn(const char *command, volatile pid_t *pidptr); +int netdata_spawn_waitpid(pid_t pid); -extern void netdata_popen_tracking_init(void); -extern void netdata_popen_tracking_cleanup(void); -extern int netdata_popen_tracking_pid_shoud_be_reaped(pid_t pid); +void netdata_popen_tracking_init(void); +void netdata_popen_tracking_cleanup(void); +int netdata_popen_tracking_pid_shoud_be_reaped(pid_t pid); -extern void signals_unblock(void); -extern void signals_reset(void); +void signals_unblock(void); +void signals_reset(void); #endif /* NETDATA_POPEN_H */ diff --git a/libnetdata/procfile/procfile.h b/libnetdata/procfile/procfile.h index 5263ad770c..5d45e4028c 100644 --- a/libnetdata/procfile/procfile.h +++ b/libnetdata/procfile/procfile.h @@ -60,25 +60,25 @@ typedef struct { } procfile; // close the proc file and free all related memory -extern void procfile_close(procfile *ff); +void procfile_close(procfile *ff); // (re)read and parse the proc file -extern procfile *procfile_readall(procfile *ff); +procfile *procfile_readall(procfile *ff); // open a /proc or /sys file -extern procfile *procfile_open(const char *filename, const char *separators, uint32_t flags); +procfile *procfile_open(const char *filename, const char *separators, uint32_t flags); // re-open a file // if separators == NULL, the last separators are used -extern procfile *procfile_reopen(procfile *ff, const char *filename, const char *separators, uint32_t flags); +procfile *procfile_reopen(procfile *ff, const char *filename, const char *separators, uint32_t flags); // example walk-through a procfile parsed file -extern void procfile_print(procfile *ff); +void procfile_print(procfile *ff); -extern void procfile_set_quotes(procfile *ff, const char *quotes); -extern void procfile_set_open_close(procfile *ff, const char *open, const char *close); +void procfile_set_quotes(procfile *ff, const char *quotes); +void procfile_set_open_close(procfile *ff, const char *open, const char *close); -extern char *procfile_filename(procfile *ff); +char *procfile_filename(procfile *ff); // ---------------------------------------------------------------------------- diff --git a/libnetdata/simple_pattern/simple_pattern.h b/libnetdata/simple_pattern/simple_pattern.h index 36fbbde7df..e4bc0abc4b 100644 --- a/libnetdata/simple_pattern/simple_pattern.h +++ b/libnetdata/simple_pattern/simple_pattern.h @@ -18,21 +18,21 @@ typedef void SIMPLE_PATTERN; // create a simple_pattern from the string given // default_mode is used in cases where EXACT matches, without an asterisk, // should be considered PREFIX matches. -extern SIMPLE_PATTERN *simple_pattern_create(const char *list, const char *separators, SIMPLE_PREFIX_MODE default_mode); +SIMPLE_PATTERN *simple_pattern_create(const char *list, const char *separators, SIMPLE_PREFIX_MODE default_mode); // test if string str is matched from the pattern and fill 'wildcarded' with the parts matched by '*' -extern int simple_pattern_matches_extract(SIMPLE_PATTERN *list, const char *str, char *wildcarded, size_t wildcarded_size); +int simple_pattern_matches_extract(SIMPLE_PATTERN *list, const char *str, char *wildcarded, size_t wildcarded_size); // test if string str is matched from the pattern #define simple_pattern_matches(list, str) simple_pattern_matches_extract(list, str, NULL, 0) // free a simple_pattern that was created with simple_pattern_create() // list can be NULL, in which case, this does nothing. -extern void simple_pattern_free(SIMPLE_PATTERN *list); +void simple_pattern_free(SIMPLE_PATTERN *list); -extern void simple_pattern_dump(uint64_t debug_type, SIMPLE_PATTERN *p) ; -extern int simple_pattern_is_potential_name(SIMPLE_PATTERN *p) ; -extern char *simple_pattern_iterate(SIMPLE_PATTERN **p); +void simple_pattern_dump(uint64_t debug_type, SIMPLE_PATTERN *p) ; +int simple_pattern_is_potential_name(SIMPLE_PATTERN *p) ; +char *simple_pattern_iterate(SIMPLE_PATTERN **p); //Auxiliary function to create a pattern char *simple_pattern_trim_around_equal(char *src); diff --git a/libnetdata/socket/security.h b/libnetdata/socket/security.h index 5c9842e07a..d180c761dc 100644 --- a/libnetdata/socket/security.h +++ b/libnetdata/socket/security.h @@ -50,7 +50,7 @@ extern const char *netdata_ssl_security_cert; extern const char *tls_version; extern const char *tls_ciphers; extern int netdata_ssl_validate_server; -extern int ssl_security_location_for_context(SSL_CTX *ctx,char *file,char *path); +int ssl_security_location_for_context(SSL_CTX *ctx,char *file,char *path); void security_openssl_library(); void security_clean_openssl(); diff --git a/libnetdata/socket/socket.h b/libnetdata/socket/socket.h index 2c78bb9744..581ca7ccfe 100644 --- a/libnetdata/socket/socket.h +++ b/libnetdata/socket/socket.h @@ -52,40 +52,40 @@ typedef struct listen_sockets { WEB_CLIENT_ACL fds_acl_flags[MAX_LISTEN_FDS]; // the acl to apply to the open sockets (dashboard, badges, streaming, netdata.conf, management) } LISTEN_SOCKETS; -extern char *strdup_client_description(int family, const char *protocol, const char *ip, uint16_t port); +char *strdup_client_description(int family, const char *protocol, const char *ip, uint16_t port); -extern int listen_sockets_setup(LISTEN_SOCKETS *sockets); -extern void listen_sockets_close(LISTEN_SOCKETS *sockets); +int listen_sockets_setup(LISTEN_SOCKETS *sockets); +void listen_sockets_close(LISTEN_SOCKETS *sockets); -extern void foreach_entry_in_connection_string(const char *destination, bool (*callback)(char *entry, void *data), void *data); -extern int connect_to_this_ip46(int protocol, int socktype, const char *host, uint32_t scope_id, const char *service, struct timeval *timeout); -extern int connect_to_this(const char *definition, int default_port, struct timeval *timeout); -extern int connect_to_one_of(const char *destination, int default_port, struct timeval *timeout, size_t *reconnects_counter, char *connected_to, size_t connected_to_size); -extern int connect_to_one_of_urls(const char *destination, int default_port, struct timeval *timeout, size_t *reconnects_counter, char *connected_to, size_t connected_to_size); +void foreach_entry_in_connection_string(const char *destination, bool (*callback)(char *entry, void *data), void *data); +int connect_to_this_ip46(int protocol, int socktype, const char *host, uint32_t scope_id, const char *service, struct timeval *timeout); +int connect_to_this(const char *definition, int default_port, struct timeval *timeout); +int connect_to_one_of(const char *destination, int default_port, struct timeval *timeout, size_t *reconnects_counter, char *connected_to, size_t connected_to_size); +int connect_to_one_of_urls(const char *destination, int default_port, struct timeval *timeout, size_t *reconnects_counter, char *connected_to, size_t connected_to_size); #ifdef ENABLE_HTTPS -extern ssize_t recv_timeout(struct netdata_ssl *ssl,int sockfd, void *buf, size_t len, int flags, int timeout); -extern ssize_t send_timeout(struct netdata_ssl *ssl,int sockfd, void *buf, size_t len, int flags, int timeout); +ssize_t recv_timeout(struct netdata_ssl *ssl,int sockfd, void *buf, size_t len, int flags, int timeout); +ssize_t send_timeout(struct netdata_ssl *ssl,int sockfd, void *buf, size_t len, int flags, int timeout); #else -extern ssize_t recv_timeout(int sockfd, void *buf, size_t len, int flags, int timeout); -extern ssize_t send_timeout(int sockfd, void *buf, size_t len, int flags, int timeout); +ssize_t recv_timeout(int sockfd, void *buf, size_t len, int flags, int timeout); +ssize_t send_timeout(int sockfd, void *buf, size_t len, int flags, int timeout); #endif -extern int sock_setnonblock(int fd); -extern int sock_delnonblock(int fd); -extern int sock_setreuse(int fd, int reuse); -extern int sock_setreuse_port(int fd, int reuse); -extern int sock_enlarge_in(int fd); -extern int sock_enlarge_out(int fd); +int sock_setnonblock(int fd); +int sock_delnonblock(int fd); +int sock_setreuse(int fd, int reuse); +int sock_setreuse_port(int fd, int reuse); +int sock_enlarge_in(int fd); +int sock_enlarge_out(int fd); -extern int connection_allowed(int fd, char *client_ip, char *client_host, size_t hostsize, +int connection_allowed(int fd, char *client_ip, char *client_host, size_t hostsize, SIMPLE_PATTERN *access_list, const char *patname, int allow_dns); -extern int accept_socket(int fd, int flags, char *client_ip, size_t ipsize, char *client_port, size_t portsize, +int accept_socket(int fd, int flags, char *client_ip, size_t ipsize, char *client_port, size_t portsize, char *client_host, size_t hostsize, SIMPLE_PATTERN *access_list, int allow_dns); #ifndef HAVE_ACCEPT4 -extern int accept4(int sock, struct sockaddr *addr, socklen_t *addrlen, int flags); +int accept4(int sock, struct sockaddr *addr, socklen_t *addrlen, int flags); #ifndef SOCK_NONBLOCK #define SOCK_NONBLOCK 00004000 @@ -173,12 +173,12 @@ struct poll { #define pollinfo_from_slot(p, slot) (&((p)->inf[(slot)])) -extern int poll_default_snd_callback(POLLINFO *pi, short int *events); -extern int poll_default_rcv_callback(POLLINFO *pi, short int *events); -extern void poll_default_del_callback(POLLINFO *pi); -extern void *poll_default_add_callback(POLLINFO *pi, short int *events, void *data); +int poll_default_snd_callback(POLLINFO *pi, short int *events); +int poll_default_rcv_callback(POLLINFO *pi, short int *events); +void poll_default_del_callback(POLLINFO *pi); +void *poll_default_add_callback(POLLINFO *pi, short int *events, void *data); -extern POLLINFO *poll_add_fd(POLLJOB *p +POLLINFO *poll_add_fd(POLLJOB *p , int fd , int socktype , WEB_CLIENT_ACL port_acl @@ -192,9 +192,9 @@ extern POLLINFO *poll_add_fd(POLLJOB *p , int (*snd_callback)(POLLINFO *pi, short int *events) , void *data ); -extern void poll_close_fd(POLLINFO *pi); +void poll_close_fd(POLLINFO *pi); -extern void poll_events(LISTEN_SOCKETS *sockets +void poll_events(LISTEN_SOCKETS *sockets , void *(*add_callback)(POLLINFO *pi, short int *events, void *data) , void (*del_callback)(POLLINFO *pi) , int (*rcv_callback)(POLLINFO *pi, short int *events) diff --git a/libnetdata/statistical/statistical.h b/libnetdata/statistical/statistical.h index 9496e0e7f8..f3ecfadb46 100644 --- a/libnetdata/statistical/statistical.h +++ b/libnetdata/statistical/statistical.h @@ -5,30 +5,30 @@ #include "../libnetdata.h" -extern void log_series_to_stderr(NETDATA_DOUBLE *series, size_t entries, NETDATA_DOUBLE result, const char *msg); +void log_series_to_stderr(NETDATA_DOUBLE *series, size_t entries, NETDATA_DOUBLE result, const char *msg); -extern NETDATA_DOUBLE average(const NETDATA_DOUBLE *series, size_t entries); -extern NETDATA_DOUBLE moving_average(const NETDATA_DOUBLE *series, size_t entries, size_t period); -extern NETDATA_DOUBLE median(const NETDATA_DOUBLE *series, size_t entries); -extern NETDATA_DOUBLE moving_median(const NETDATA_DOUBLE *series, size_t entries, size_t period); -extern NETDATA_DOUBLE running_median_estimate(const NETDATA_DOUBLE *series, size_t entries); -extern NETDATA_DOUBLE standard_deviation(const NETDATA_DOUBLE *series, size_t entries); -extern NETDATA_DOUBLE single_exponential_smoothing(const NETDATA_DOUBLE *series, size_t entries, NETDATA_DOUBLE alpha); +NETDATA_DOUBLE average(const NETDATA_DOUBLE *series, size_t entries); +NETDATA_DOUBLE moving_average(const NETDATA_DOUBLE *series, size_t entries, size_t period); +NETDATA_DOUBLE median(const NETDATA_DOUBLE *series, size_t entries); +NETDATA_DOUBLE moving_median(const NETDATA_DOUBLE *series, size_t entries, size_t period); +NETDATA_DOUBLE running_median_estimate(const NETDATA_DOUBLE *series, size_t entries); +NETDATA_DOUBLE standard_deviation(const NETDATA_DOUBLE *series, size_t entries); +NETDATA_DOUBLE single_exponential_smoothing(const NETDATA_DOUBLE *series, size_t entries, NETDATA_DOUBLE alpha); extern NETDATA_DOUBLE single_exponential_smoothing_reverse(const NETDATA_DOUBLE *series, size_t entries, NETDATA_DOUBLE alpha); -extern NETDATA_DOUBLE double_exponential_smoothing(const NETDATA_DOUBLE *series, size_t entries, +NETDATA_DOUBLE double_exponential_smoothing(const NETDATA_DOUBLE *series, size_t entries, NETDATA_DOUBLE alpha, NETDATA_DOUBLE beta, NETDATA_DOUBLE *forecast); -extern NETDATA_DOUBLE holtwinters(const NETDATA_DOUBLE *series, size_t entries, +NETDATA_DOUBLE holtwinters(const NETDATA_DOUBLE *series, size_t entries, NETDATA_DOUBLE alpha, NETDATA_DOUBLE beta, NETDATA_DOUBLE gamma, NETDATA_DOUBLE *forecast); -extern NETDATA_DOUBLE sum_and_count(const NETDATA_DOUBLE *series, size_t entries, size_t *count); -extern NETDATA_DOUBLE sum(const NETDATA_DOUBLE *series, size_t entries); -extern NETDATA_DOUBLE median_on_sorted_series(const NETDATA_DOUBLE *series, size_t entries); -extern NETDATA_DOUBLE *copy_series(const NETDATA_DOUBLE *series, size_t entries); -extern void sort_series(NETDATA_DOUBLE *series, size_t entries); +NETDATA_DOUBLE sum_and_count(const NETDATA_DOUBLE *series, size_t entries, size_t *count); +NETDATA_DOUBLE sum(const NETDATA_DOUBLE *series, size_t entries); +NETDATA_DOUBLE median_on_sorted_series(const NETDATA_DOUBLE *series, size_t entries); +NETDATA_DOUBLE *copy_series(const NETDATA_DOUBLE *series, size_t entries); +void sort_series(NETDATA_DOUBLE *series, size_t entries); #endif //NETDATA_STATISTICAL_H diff --git a/libnetdata/string/string.h b/libnetdata/string/string.h index f527f042ff..cec44ebd99 100644 --- a/libnetdata/string/string.h +++ b/libnetdata/string/string.h @@ -8,14 +8,14 @@ // STRING implementation typedef struct netdata_string STRING; -extern STRING *string_strdupz(const char *str); -extern STRING *string_dup(STRING *string); -extern void string_freez(STRING *string); -extern size_t string_strlen(STRING *string); -extern const char *string2str(STRING *string) NEVERNULL; +STRING *string_strdupz(const char *str); +STRING *string_dup(STRING *string); +void string_freez(STRING *string); +size_t string_strlen(STRING *string); +const char *string2str(STRING *string) NEVERNULL; // keep common prefix/suffix and replace everything else with [x] -extern STRING *string_2way_merge(STRING *a, STRING *b); +STRING *string_2way_merge(STRING *a, STRING *b); static inline int string_cmp(STRING *s1, STRING *s2) { // STRINGs are deduplicated, so the same strings have the same pointer @@ -23,8 +23,8 @@ static inline int string_cmp(STRING *s1, STRING *s2) { return (s1 == s2)?0:strcmp(string2str(s1), string2str(s2)); } -extern void string_statistics(size_t *inserts, size_t *deletes, size_t *searches, size_t *entries, size_t *references, size_t *memory, size_t *duplications, size_t *releases); +void string_statistics(size_t *inserts, size_t *deletes, size_t *searches, size_t *entries, size_t *references, size_t *memory, size_t *duplications, size_t *releases); -extern int string_unittest(size_t entries); +int string_unittest(size_t entries); #endif diff --git a/libnetdata/threads/threads.h b/libnetdata/threads/threads.h index 854503f315..ccc18aff0a 100644 --- a/libnetdata/threads/threads.h +++ b/libnetdata/threads/threads.h @@ -5,7 +5,7 @@ #include "../libnetdata.h" -extern pid_t gettid(void); +pid_t gettid(void); typedef enum { NETDATA_THREAD_OPTION_DEFAULT = 0 << 0, @@ -21,27 +21,27 @@ typedef enum { typedef pthread_t netdata_thread_t; #define NETDATA_THREAD_TAG_MAX 100 -extern const char *netdata_thread_tag(void); -extern int netdata_thread_tag_exists(void); +const char *netdata_thread_tag(void); +int netdata_thread_tag_exists(void); -extern size_t netdata_threads_init(void); -extern void netdata_threads_init_after_fork(size_t stacksize); +size_t netdata_threads_init(void); +void netdata_threads_init_after_fork(size_t stacksize); -extern int netdata_thread_create(netdata_thread_t *thread, const char *tag, NETDATA_THREAD_OPTIONS options, void *(*start_routine) (void *), void *arg); +int netdata_thread_create(netdata_thread_t *thread, const char *tag, NETDATA_THREAD_OPTIONS options, void *(*start_routine) (void *), void *arg); #ifdef NETDATA_INTERNAL_CHECKS #define netdata_thread_cancel(thread) netdata_thread_cancel_with_trace(thread, __LINE__, __FILE__, __FUNCTION__) -extern int netdata_thread_cancel_with_trace(netdata_thread_t thread, int line, const char *file, const char *function); +int netdata_thread_cancel_with_trace(netdata_thread_t thread, int line, const char *file, const char *function); #else -extern int netdata_thread_cancel(netdata_thread_t thread); +int netdata_thread_cancel(netdata_thread_t thread); #endif -extern int netdata_thread_join(netdata_thread_t thread, void **retval); -extern int netdata_thread_detach(pthread_t thread); +int netdata_thread_join(netdata_thread_t thread, void **retval); +int netdata_thread_detach(pthread_t thread); #define NETDATA_THREAD_NAME_MAX 15 -extern void uv_thread_set_name_np(uv_thread_t ut, const char* name); -extern void os_thread_get_current_name_np(char threadname[NETDATA_THREAD_NAME_MAX + 1]); +void uv_thread_set_name_np(uv_thread_t ut, const char* name); +void os_thread_get_current_name_np(char threadname[NETDATA_THREAD_NAME_MAX + 1]); #define netdata_thread_self pthread_self #define netdata_thread_testcancel pthread_testcancel diff --git a/libnetdata/url/url.h b/libnetdata/url/url.h index 10f3fe1763..da0f69ac1c 100644 --- a/libnetdata/url/url.h +++ b/libnetdata/url/url.h @@ -10,26 +10,26 @@ // code from: http://www.geekhideout.com/urlcode.shtml /* Converts a hex character to its integer value */ -extern char from_hex(char ch); +char from_hex(char ch); /* Converts an integer value to its hex character*/ -extern char to_hex(char code); +char to_hex(char code); /* Returns a url-encoded version of str */ /* IMPORTANT: be sure to free() the returned string after use */ -extern char *url_encode(char *str); +char *url_encode(char *str); /* Returns a url-decoded version of str */ /* IMPORTANT: be sure to free() the returned string after use */ -extern char *url_decode(char *str); +char *url_decode(char *str); -extern char *url_decode_r(char *to, char *url, size_t size); +char *url_decode_r(char *to, char *url, size_t size); #define WEB_FIELDS_MAX 400 -extern int url_map_query_string(char **out, char *url); -extern int url_parse_query_string(char *output, size_t max, char **map, int total); +int url_map_query_string(char **out, char *url); +int url_parse_query_string(char *output, size_t max, char **map, int total); -extern int url_is_request_complete(char *begin,char *end,size_t length); -extern char *url_find_protocol(char *s); +int url_is_request_complete(char *begin,char *end,size_t length); +char *url_find_protocol(char *s); #endif /* NETDATA_URL_H */ diff --git a/libnetdata/worker_utilization/worker_utilization.h b/libnetdata/worker_utilization/worker_utilization.h index b64d76a9ed..aed893ed2d 100644 --- a/libnetdata/worker_utilization/worker_utilization.h +++ b/libnetdata/worker_utilization/worker_utilization.h @@ -14,18 +14,18 @@ typedef enum { WORKER_METRIC_INCREMENTAL = 3, } WORKER_METRIC_TYPE; -extern void worker_register(const char *workname); -extern void worker_register_job_name(size_t job_id, const char *name); -extern void worker_register_job_custom_metric(size_t job_id, const char *name, const char *units, WORKER_METRIC_TYPE type); -extern void worker_unregister(void); +void worker_register(const char *workname); +void worker_register_job_name(size_t job_id, const char *name); +void worker_register_job_custom_metric(size_t job_id, const char *name, const char *units, WORKER_METRIC_TYPE type); +void worker_unregister(void); -extern void worker_is_idle(void); -extern void worker_is_busy(size_t job_id); -extern void worker_set_metric(size_t job_id, NETDATA_DOUBLE value); +void worker_is_idle(void); +void worker_is_busy(size_t job_id); +void worker_set_metric(size_t job_id, NETDATA_DOUBLE value); // statistics interface -extern void workers_foreach(const char *workname, void (*callback)( +void workers_foreach(const char *workname, void (*callback)( void *data , pid_t pid , const char *thread_tag |