Kaydet (Commit) 29080fd3 authored tarafından S.Çağlar Onur's avatar S.Çağlar Onur

Fix following valid sparse warnings;

comar/src/data.c:49:5: warning: mixing declarations and code
comar/src/data.c:25:1: warning: symbol 'db_init' was not declared. Should it be static?
comar/src/data.c:345:6: warning: symbol 'get_script_path' was not declared. Should it be static?
comar/src/data.c:373:1: warning: symbol 'db_register_model' was not declared. Should it be static?
comar/src/data.c:403:1: warning: symbol 'db_remove_app' was not declared. Should it be static?
comar/src/data.c:481:1: warning: symbol 'db_get_apps' was not declared. Should it be static?
comar/src/data.c:504:1: warning: symbol 'db_get_app_models' was not declared. Should it be static?
comar/src/data.c:528:1: warning: symbol 'db_get_model_apps' was not declared. Should it be static?
comar/src/data.c:552:1: warning: symbol 'db_check_app' was not declared. Should it be static?
comar/src/data.c:574:1: warning: symbol 'db_check_model' was not declared. Should it be static?
comar/src/utility.c:48:5: warning: mixing declarations and code
üst 622deeb7
...@@ -11,8 +11,13 @@ SET (VERSION_PATCH "0") ...@@ -11,8 +11,13 @@ SET (VERSION_PATCH "0")
# Uncomment this for production releases. # Uncomment this for production releases.
SET (VERSION_SUFFIX "alpha1") SET (VERSION_SUFFIX "alpha1")
SET (FLAGS "-g -O0 -Werror -Wcast-align -Wno-uninitialized -Wall -fstrict-aliasing") # -fprofile-arcs -ftest-coverage") SET (FLAGS "-g -O0 -Werror -Wcast-align -Wno-uninitialized -Wall -fstrict-aliasing")
# Uncomment this for gprof profiling
# SET (FLAGS "-g -O0 -Werror -Wcast-align -Wno-uninitialized -Wall -fstrict-aliasing -fprofile-arcs -ftest-coverage")
SET (CMAKE_C_FLAGS "${FLAGS}") SET (CMAKE_C_FLAGS "${FLAGS}")
# Uncomment this for sparse building
# SET (CMAKE_C_COMPILER cgcc)
# Append version suffix, if specified # Append version suffix, if specified
SET (VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}) SET (VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH})
......
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
#include <sys/file.h> #include <sys/file.h>
#include <unistd.h> #include <unistd.h>
#include "data.h"
#include "cfg.h" #include "cfg.h"
#include "log.h" #include "log.h"
#include "utility.h" #include "utility.h"
...@@ -32,6 +33,7 @@ db_init(void) ...@@ -32,6 +33,7 @@ db_init(void)
struct stat fs; struct stat fs;
size_t size; size_t size;
char *code_dir;
if (stat(cfg_data_dir, &fs) != 0) { if (stat(cfg_data_dir, &fs) != 0) {
if (0 != mkdir(cfg_data_dir, S_IRWXU)) { if (0 != mkdir(cfg_data_dir, S_IRWXU)) {
...@@ -46,7 +48,7 @@ db_init(void) ...@@ -46,7 +48,7 @@ db_init(void)
} }
size = strlen(cfg_data_dir) + 6; size = strlen(cfg_data_dir) + 6;
char *code_dir = malloc(size); code_dir = malloc(size);
if (!code_dir) return -3; if (!code_dir) return -3;
snprintf(code_dir, size, "%s/code", cfg_data_dir); snprintf(code_dir, size, "%s/code", cfg_data_dir);
code_dir[size -1] = '\0'; code_dir[size -1] = '\0';
......
...@@ -28,6 +28,7 @@ strsub(const char *str, int start, int end) ...@@ -28,6 +28,7 @@ strsub(const char *str, int start, int end)
* @end Where to end * @end Where to end
* @return Requested part * @return Requested part
*/ */
char *new_src, *t;
if (start < 0) { if (start < 0) {
start = strlen(str) + start; start = strlen(str) + start;
...@@ -45,7 +46,6 @@ strsub(const char *str, int start, int end) ...@@ -45,7 +46,6 @@ strsub(const char *str, int start, int end)
end = strlen(str); end = strlen(str);
} }
char *new_src, *t;
new_src = malloc(end - start + 2); new_src = malloc(end - start + 2);
for (t = (char *) str + start; t < str + end; t++) { for (t = (char *) str + start; t < str + end; t++) {
new_src[t - (str + start)] = *t; new_src[t - (str + start)] = *t;
......
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