Commit fec59385 authored by Amin Ben Ramdhane's avatar Amin Ben Ramdhane

BulkData: cleanup

parent 8f5f0eeb
Pipeline #986 passed with stage
in 48 seconds
......@@ -264,7 +264,8 @@ icwmp_bulkdatad_CFLAGS = \
$(LIBUCI_CFLAGS) \
$(LIBUBUS_CFLAGS) \
$(LIBUBOX_CFLAGS) \
$(LIBCURL_CFLAGS)
$(LIBCURL_CFLAGS) \
-Wall -Werror
icwmp_bulkdatad_LDFLAGS = \
$(AM_LDFLAGS) \
......
......@@ -9,18 +9,9 @@
*
*/
#include <strings.h>
#include <string.h>
#include <stdlib.h>
#include <stdarg.h>
#include <errno.h>
#include <unistd.h>
#include <ctype.h>
#include "buci.h"
struct uci_context *uci_ctx;
struct uci_context *uci_ctx = NULL;
int buci_init(void)
{
......@@ -58,9 +49,6 @@ static bool buci_validate_section(const char *str)
static int buci_init_ptr(struct uci_context *ctx, struct uci_ptr *ptr, char *package, char *section, char *option, char *value)
{
char *last = NULL;
char *tmp;
memset(ptr, 0, sizeof(struct uci_ptr));
/* value */
......@@ -126,8 +114,7 @@ struct uci_section *buci_walk_section(char *package, char *section_type, struct
}
}
else {
struct uci_list *ul, *u = NULL;
struct uci_list *shead = NULL;
struct uci_list *ul, *shead = NULL;
if (prev_section) {
ul = &prev_section->e.list;
......@@ -159,8 +146,6 @@ void buci_print_list(struct uci_list *uh, char **val, char *delimiter)
{
struct uci_element *e;
static char buffer[512];
int dlen = strlen(delimiter);
int olen = 0;
char *buf = buffer;
*buf = '\0';
......
......@@ -12,6 +12,13 @@
#ifndef __BUCI_H
#define __BUCI_H
#include <strings.h>
#include <string.h>
#include <stdlib.h>
#include <stdarg.h>
#include <errno.h>
#include <unistd.h>
#include <ctype.h>
#include <uci.h>
int buci_init(void);
......
......@@ -15,7 +15,4 @@
extern struct bulkdata bulkdata_main;
extern int profiles_number;
#endif /* __BULKDATA_H */
......@@ -14,17 +14,6 @@
static pathnode *head = NULL;
static pathnode *temphead = NULL;
void add_list_value_change(char *param_name, char *param_data, char *param_type)
{
bulkdata_log(SDEBUG,"Dummy funtion");
if(param_name && param_data && param_type){}
}
void send_active_value_change(void)
{
bulkdata_log(SDEBUG,"Dummy funtion");
}
int bulkdata_dm_ctx_init(struct dmctx *ctx)
{
struct bulkdata *bulkdata = &bulkdata_main;
......@@ -115,14 +104,14 @@ static void insert(char *data, bool active)
}
}
static void swap_heads()
static void swap_heads(void)
{
pathnode *temp = head;
head = temphead;
temphead = temp;
}
static void deleteList()
static void deleteList(void)
{
pathnode *ptr = head, *temp;
while(ptr != NULL) {
......@@ -239,7 +228,7 @@ bool bulkdata_get_name(char *path)
return ret;
}
static void fill_node_path()
static void fill_node_path(void)
{
pathnode *p=head;
while(p!=NULL) {
......@@ -389,7 +378,7 @@ char *get_bulkdata_profile_parameter_name(char *paramref, char *paramname, char
void append_string_to_string(char *strappend, char **target)
{
char *tmp = NULL, *str = NULL;
char *tmp = NULL;
if(strappend == NULL || strlen(strappend) <= 0)
return;
......
......@@ -9,16 +9,7 @@
* Omar Kallel <omar.kallel@pivasoftware.com>
*/
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <errno.h>
#include <curl/curl.h>
#include "http.h"
#include "log.h"
#include "times.h"
#include "common.h"
static struct http_client http_c;
static CURL *curl;
......
......@@ -12,8 +12,15 @@
#ifndef __HTTP_H
#define __HTTP_H
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <errno.h>
#include <curl/curl.h>
#include "config.h"
#include "log.h"
#include "times.h"
#include "common.h"
#define HTTP_TIMEOUT 30
......
......@@ -10,10 +10,6 @@
*
*/
#include <json-c/json.h>
#include "common.h"
#include "times.h"
#include "report.h"
static void add_new_json_obj(json_object *json_obj, char *name, char *data, char *type)
......@@ -202,7 +198,7 @@ int create_csv_bulkdata_report(struct profile *profile, char **report)
*/
int i;
struct resultsnode *p;
char *str1 = NULL, *str2 = NULL, *str = NULL, *paramprofilename, *timestamp = NULL, *type = NULL, rowseparator, separator;
char *str1 = NULL, *str2 = NULL, *str = NULL, *paramprofilename, *timestamp = NULL, *type = NULL, rowseparator = '\0', separator = '\0';
if(strcmp(profile->csv_encoding_row_separator, "&#10;") == 0)
rowseparator = '\n';
......@@ -300,7 +296,7 @@ static void create_json_failed_report(struct profile *profile, char **report)
static void create_csv_failed_report(struct profile *profile, char **report)
{
char rowseparator, separator, *timestamp;
char rowseparator = '\0', separator = '\0', *timestamp = NULL;
if(strcmp(profile->csv_encoding_row_separator, "&#10;") == 0) {
rowseparator = '\n';
......
......@@ -13,6 +13,9 @@
#ifndef __REPORT_H_
#define __REPORT_H_
#include <json-c/json.h>
#include "common.h"
#include "times.h"
#include "config.h"
void create_encoding_bulkdata_report(struct profile *profile, char **report);
......
......@@ -9,8 +9,7 @@
*
*/
#include <string.h>
#include <time.h>
#include "times.h"
char *bulkdata_get_time(void)
{
......
......@@ -12,6 +12,10 @@
#ifndef __TIMES_H
#define __TIMES_H
#include <stdio.h>
#include <string.h>
#include <time.h>
char *bulkdata_get_time(void);
void get_time_stamp(char *format, char **timestamp);
unsigned int get_next_period(time_t time_reference, int reporting_interval);
......
......@@ -9,4 +9,3 @@ config stun 'stun'
#if client_port option is not set or < 0 then use a random port for connection request source port
#Log levels: Critical=0, Warning=1, Notice=2, Info=3, Debug=4
option log_level '3'
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment