aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnastasis Grammenos <anastasis.gramm2@gmail.com>2018-10-25 12:38:34 +0300
committerAnastasis Grammenos <anastasis.gramm2@gmail.com>2018-10-25 12:38:34 +0300
commitd29c929e444d69ea7d4ce146f67f4c8df36baa95 (patch)
tree7f79ce61f0826b151ee4a1108c4b307afc953d15
parent041274604961bc5633c70f9c3db90f46117c508e (diff)
downloadck-d29c929e444d69ea7d4ce146f67f4c8df36baa95.tar.gz
ck-d29c929e444d69ea7d4ce146f67f4c8df36baa95.tar.bz2
ck-d29c929e444d69ea7d4ce146f67f4c8df36baa95.zip
Don't forward declare enumerations
-rw-r--r--src/actionparser.c2
-rw-r--r--src/actionparser.h6
-rw-r--r--src/actions.c3
-rw-r--r--src/actions.h8
-rw-r--r--src/ckerrlog.c1
-rw-r--r--src/ckerrlog.h5
-rw-r--r--src/ckutil.c1
-rw-r--r--src/ckutil.h3
-rw-r--r--src/confparser.c4
-rw-r--r--src/confparser.h4
-rw-r--r--src/dblayer.h2
11 files changed, 15 insertions, 24 deletions
diff --git a/src/actionparser.c b/src/actionparser.c
index 7ee46fe..009ee2a 100644
--- a/src/actionparser.c
+++ b/src/actionparser.c
@@ -8,8 +8,8 @@
* GPLv3 (see LICENCE for the full notice)
*
* -------------------------------------------------------------------------- */
-#include "actionparser.h"
#include "ckutil.h"
+#include "actionparser.h"
#include "ckinfo.h"
#include "ckerrlog.h"
diff --git a/src/actionparser.h b/src/actionparser.h
index def4c8f..6fa6136 100644
--- a/src/actionparser.h
+++ b/src/actionparser.h
@@ -29,7 +29,6 @@
X(SEARCH) \
X(HELP)
-typedef enum ParseErrors ParseError;
enum ParseErrors {
PERR_NOERR = 0,
#define X(ACTION) \
@@ -38,8 +37,8 @@ enum ParseErrors {
#undef X
PERR_UNKONW_ACTION,
};
+typedef enum ParseErrors ParseError;
-typedef enum CkActions CkAction;
enum CkActions {
CK_WRONG_ACTION,
#define X(ACTION) \
@@ -47,14 +46,15 @@ enum CkActions {
CK_ACTIONS
#undef X
};
+typedef enum CkActions CkAction;
-typedef enum ActionParserResults ActionParseResult;
enum ActionParserResults {
APR_OK,
APR_ERR,
APR_HELP,
APR_VERSION
};
+typedef enum ActionParserResults ActionParseResult;
typedef struct UserOptions UserOpt;
struct UserOptions {
diff --git a/src/actions.c b/src/actions.c
index 7cbd32a..4fc033e 100644
--- a/src/actions.c
+++ b/src/actions.c
@@ -8,9 +8,6 @@
* GPLv3 (see LICENCE for the full notice)
*
* -------------------------------------------------------------------------- */
-#include <limits.h>
-#include <stdlib.h>
-
#include "actions.h"
#include "actionhelper.h"
#include "dblayer.h"
diff --git a/src/actions.h b/src/actions.h
index dcc6a23..69c5616 100644
--- a/src/actions.h
+++ b/src/actions.h
@@ -25,12 +25,12 @@
CK_ACTIONS
#undef X
-typedef enum AddOptErrors AddOptErr;
enum AddOptErrors {
ADD_NO_ERR = 0,
ADD_ERR_WRONG_CONFIG,
ADD_ERR_WRONG_FLAGS
};
+typedef enum AddOptErrors AddOptErr;
typedef struct AddOptions AddOpt;
struct AddOptions {
@@ -41,12 +41,12 @@ struct AddOptions {
AddOptErr err;
};
-typedef enum DelErrors DelErr;
enum DelErrors {
DEL_NO_ERR = 0,
DEL_ERR_WRONG_PATH,
DEL_ERR_WRONG_ARGS
};
+typedef enum DelErrors DelErr;
typedef struct DelOptions DelOpt;
struct DelOptions {
@@ -55,7 +55,6 @@ struct DelOptions {
DelErr err;
};
-typedef enum ListTypes ListType;
enum ListTypes {
LT_PATH,
LT_PROGRAM,
@@ -63,13 +62,14 @@ enum ListTypes {
LT_CKCONF,
LT_PROG_CONFS
};
+typedef enum ListTypes ListType;
-typedef enum ListShowTypes ListShowType;
enum ListShowTypes {
LST_PLAIN,
LST_LISP,
LST_PYTHON,
};
+typedef enum ListShowTypes ListShowType;
typedef struct ListOptions ListOpt;
struct ListOptions {
diff --git a/src/ckerrlog.c b/src/ckerrlog.c
index 357d112..0d0c30d 100644
--- a/src/ckerrlog.c
+++ b/src/ckerrlog.c
@@ -11,7 +11,6 @@
#include <time.h>
#include "ckerrlog.h"
-#include "ckutil.h"
#include "cklist.h"
ERRLOG(logger);
diff --git a/src/ckerrlog.h b/src/ckerrlog.h
index a559764..66923cb 100644
--- a/src/ckerrlog.h
+++ b/src/ckerrlog.h
@@ -38,10 +38,9 @@
#ifndef CKERRLOG_H
#define CKERRLOG_H
-#include <stdlib.h>
#include <stdarg.h>
-#include <string.h>
-#include <stdio.h>
+
+#include "ckutil.h"
#define CK_STREAMS \
X(err) \
diff --git a/src/ckutil.c b/src/ckutil.c
index 6ce736c..b852f72 100644
--- a/src/ckutil.c
+++ b/src/ckutil.c
@@ -10,7 +10,6 @@
* -------------------------------------------------------------------------- */
#include <ctype.h>
#include <dirent.h>
-#include <limits.h>
#include <fcntl.h>
#include <libgen.h>
#include <sys/sendfile.h>
diff --git a/src/ckutil.h b/src/ckutil.h
index a16a5de..dde7665 100644
--- a/src/ckutil.h
+++ b/src/ckutil.h
@@ -20,10 +20,11 @@
/*******************/
#include <stdio.h>
+#include <limits.h>
#include <stdlib.h>
#include <string.h>
-#define PRINT_ERR(ERROR) \
+#define PRINT_ERR(ERROR) \
printf("--[ Error ]--\n%s\n", ERROR);
#define UNUSED(x) (void)(x)
diff --git a/src/confparser.c b/src/confparser.c
index 2463d79..95c8704 100644
--- a/src/confparser.c
+++ b/src/confparser.c
@@ -8,10 +8,6 @@
* GPLv3 (see LICENCE for the full notice)
*
* -------------------------------------------------------------------------- */
-#include <stdlib.h>
-#include <string.h>
-#include <stdio.h>
-
#include "ckutil.h"
#include "confparser.h"
#include "ckerrlog.h"
diff --git a/src/confparser.h b/src/confparser.h
index 75201e4..261dc72 100644
--- a/src/confparser.h
+++ b/src/confparser.h
@@ -22,15 +22,14 @@
X(vc_dir, " version_control_dir = %s ", "Version Control directory") \
X(scrt_dir, " secret_dir = %s " , "Secret directory")
-typedef enum ConfingVariables ConfVar;
enum ConfingVariables {
CV_NO_VAL_OR_COMMENT,
#define X(var, str, name) CV_##var,
CONFIG_VARIABLES_TABLE
#undef X
};
+typedef enum ConfingVariables ConfVar;
-typedef enum ConfigParserResults ConfigParserResult;
enum ConfigParserResults {
CPR_OK,
CPR_NO_CONFIG_FILE,
@@ -40,6 +39,7 @@ enum ConfigParserResults {
CONFIG_VARIABLES_TABLE
#undef X
};
+typedef enum ConfigParserResults ConfigParserResult;
typedef struct ConfigValues Conf;
struct ConfigValues {
diff --git a/src/dblayer.h b/src/dblayer.h
index c99f143..94ef7ea 100644
--- a/src/dblayer.h
+++ b/src/dblayer.h
@@ -19,7 +19,6 @@
#include "actions.h"
-typedef enum SqlErrors SqlError;
enum SqlErrors {
SQL_NO_ERR = 0,
SQL_ERR_NO_DB_FILE,
@@ -28,6 +27,7 @@ enum SqlErrors {
SQL_CONFIG_PATH_EXISTS,
SQL_ERR_PRIMARY_REDEFINITION
};
+typedef enum SqlErrors SqlError;
typedef struct DBstruct DB;
struct DBstruct {