Commit 22f48149 authored by Giovanne Marcelo's avatar Giovanne Marcelo

fix warnings

parent 61d99544
Pipeline #6332 passed with stage
in 1 minute and 16 seconds
......@@ -15,12 +15,12 @@
typedef PGresult DBresult;
PGconn* db_connect();
PGconn* db_connect(void);
char* db_get_value(DBresult *result, int row, int column);
int db_count_colums(DBresult *result);
int db_count(DBresult *result);
DBresult* db_select(char *columns, char *table, char *where);
DBresult* db_find_by_id(int id, char *table);
DBresult* db_select(const char *columns, const char *table, const char *where);
DBresult* db_find_by_id(int id, const char *table);
void db_disconnect(PGconn *conn);
void read_conf(const char *path, char * conninfo);
......
......@@ -13,10 +13,10 @@
#define warn(msg) log_warn(msg, __LINE__, __FILE__)
FILE* open_log();
void log_error(char* msg, int line, char *file);
void log_warn(char* msg, int line, char *file);
void log_info(char* msg, int line, char *file);
FILE* open_log(void);
void log_error(const char* msg, int line, const char *file);
void log_warn(const char* msg, int line, const char *file);
void log_info(const char* msg, int line, const char *file);
void close_log(FILE *stream);
void write_date(FILE *stream);
......
......@@ -33,7 +33,7 @@ void read_conf(const char *path, char * conninfo) {
}
}
PGconn* db_connect() {
PGconn* db_connect(void) {
char conninfo[CONNINFO_LEN];
......@@ -55,7 +55,7 @@ PGconn* db_connect() {
return conn;
}
DBresult* db_select( char *columns, char *table, char *where) {
DBresult* db_select( const char *columns, const char *table, const char *where) {
PGconn *conn = db_connect();
char query[QUERY_LEN];
......@@ -82,7 +82,7 @@ DBresult* db_select( char *columns, char *table, char *where) {
return result;
}
DBresult* db_find_by_id(int id, char *table) {
DBresult* db_find_by_id(int id, const char *table) {
char query[QUERY_LEN];
sprintf(query,"id=%d", id);
return db_select("*", table, query);
......
......@@ -7,7 +7,8 @@
*/
#include "log.h"
FILE* open_log() {
FILE* open_log(void) {
FILE * stream;
struct stat st = {0};
if( stat("./log", &st) == -1 ) {
......@@ -17,7 +18,7 @@ FILE* open_log() {
return stream;
}
void log_error(char* msg, int line, char *file) {
void log_error(const char* msg, int line, const char *file) {
FILE *stream = open_log();
write_date(stream);
fprintf(stream, "%s:%d - [ERROR] - %s\n",file, line, msg);
......@@ -25,7 +26,7 @@ void log_error(char* msg, int line, char *file) {
close_log(stream);
}
void log_warn(char* msg, int line, char *file) {
void log_warn(const char* msg, int line, const char *file) {
FILE *stream = open_log();
write_date(stream);
fprintf(stream, "%s:%d - [WARN] - %s\n", file, line, msg);
......@@ -33,7 +34,7 @@ void log_warn(char* msg, int line, char *file) {
close_log(stream);
}
void log_info(char* msg, int line, char *file) {
void log_info(const char* msg, int line, const char *file) {
FILE *stream = open_log();
write_date(stream);
fprintf(stream, "%s:%d - [INFO] - %s\n", file, line, msg);
......
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