Revert "Make clang happy"

This reverts commit 3b57d46503.
It would seem this causes some clang versions to explode quite violently.
And in truth, parts of this change should not be necessary (the struct
zero initialisation)
This commit is contained in:
Ikey Doherty
2015-07-22 20:14:14 +01:00
parent 3b57d46503
commit 70dc6733ff
9 changed files with 33 additions and 11 deletions
+1 -1
View File
@@ -270,7 +270,7 @@ static void process_node(CveDB *self, xmlTextReaderPtr r)
{
const xmlChar *name = NULL;
const xmlChar *value = NULL;
struct vulnerability_t vuln = {.vendor = 0};
struct vulnerability_t vuln = {0};
xmlChar *uri = NULL;
int64_t last_mod = -1;
+1
View File
@@ -307,6 +307,7 @@ char *template_context_process_line(TemplateContext *self, const char *original,
while ((c = memchr(input->str+offset, '{', input->len-offset))) {
autofree(cve_string) *newstr = NULL;
autofree(cve_string) *left = NULL;
TCValue *val = NULL;
int oldoffset = offset;
+2 -2
View File
@@ -34,7 +34,7 @@ DEF_AUTOFREE(char, free)
bool find_sources(const char *path, package_match_func match, bool recurse)
{
struct stat st = {.st_ino = 0};
struct stat st = {0};
bool ret = false;
DIR *dir = NULL;
struct dirent *ent = NULL;
@@ -85,7 +85,7 @@ PackageType guess_package_type(gchar *path, bool recurse)
DIR *dir = NULL;
struct dirent *ent = NULL;
PackageType type = PACKAGE_TYPE_UNKNOWN;
struct stat st = {.st_ino = 0}, stc = {.st_ino = 0};
struct stat st = {0}, stc = {0};
char *p = realpath(path, NULL);
if (!p) {
+2 -2
View File
@@ -254,13 +254,13 @@ static inline void package_free(void *p)
static inline bool cve_file_exists(const char *p)
{
struct stat st = {.st_ino = 0};
struct stat st = {0};
return (stat(p,&st) == 0);
}
static inline bool cve_is_dir(const char *p)
{
struct stat st = {.st_ino = 0};
struct stat st = {0};
if (stat(p, &st) != 0) {
return false;
}
+3 -3
View File
@@ -248,7 +248,7 @@ static GOptionEntry _entries[] = {
{ "auto-bug", 'b', 0, G_OPTION_ARG_NONE, &auto_bug, "Enable automatic bug tracking", NULL },
{ "auto-bug-template", 'j', 0, G_OPTION_ARG_STRING, &auto_bug_template, "Path to optional auto-bug json template file", NULL },
{ "mapping", 'M', 0, G_OPTION_ARG_STRING, &mapping_file, "Path to a mapping file", NULL},
{ .short_name = 0 }
{ NULL }
};
static bool set_package_type(PackageType type)
@@ -283,7 +283,7 @@ static bool set_package_type(PackageType type)
/**
* Helper utility to free the bug struct
*/
__attribute__ ((unused)) static inline void bug_free(void *p)
static inline void bug_free(void *p)
{
struct jira_issue_t *t = p;
@@ -422,7 +422,7 @@ int main(int argc, char **argv)
autofree(CveDB) *cve_db = NULL;
int ret = EXIT_FAILURE;
PackageType type = PACKAGE_TYPE_UNKNOWN;
CveCheckTool instance = {.is_patched = 0};
CveCheckTool instance = {0};
instance.modified = -1;
time_t ti;
CvePlugin *report = NULL;
+19
View File
@@ -23,6 +23,23 @@
#define NVD_CVE_URI "http://web.nvd.nist.gov/view/vuln/detail?vulnId="
static inline gchar *_concat(gchar *source, gchar *moar)
{
gchar *ret = g_strconcat(source, moar, NULL);
if (ret) {
g_free(source);
return ret;
}
return source;
}
static inline gchar *dotemplate(GHashTable *k, char *p)
{
gchar *ret = template_string(p, k);
g_free(p);
return ret;
}
static inline bool load_template(const char *tmpl_name, gchar **ret)
{
autofree(GError) *error = NULL;
@@ -112,6 +129,7 @@ bool write_report(CveCheckTool *self)
}
for (c = v->issues; c; c = c->next) {
autofree(gchar) *ent = NULL;
c_entry = cve_db_get_cve(self->cve_db, (gchar*)c->data);
if (self->modified > 0 && c_entry->modified > self->modified) {
cve_free(c_entry);
@@ -141,6 +159,7 @@ bool write_report(CveCheckTool *self)
}
if (!self->hide_patched && v->patched) {
for (c = v->patched; c; c = c->next) {
autofree(gchar) *ent = NULL;
c_entry = cve_db_get_cve(self->cve_db, (gchar*)c->data);
if (self->modified > 0 && c_entry->modified > self->modified) {
+1 -1
View File
@@ -45,7 +45,7 @@ static bool _quiet = false;
static GOptionEntry _entries[] = {
{ "version", 'v', 0, G_OPTION_ARG_NONE, &_show_version, "Show version", NULL },
{ "quiet", 'q', 0, G_OPTION_ARG_NONE, &_quiet, "Run silently", NULL },
{ .short_name = 0 }
{ NULL }
};
/**
+3 -1
View File
@@ -46,7 +46,7 @@ bool update_required()
time_t t;
autofree(gchar) *db = get_db_path();
struct stat st = {.st_ino = 0};
struct stat st = {0};
if (stat(db, &st) != 0) {
return true;
}
@@ -61,6 +61,8 @@ bool update_required()
bool update_db(bool quiet)
{
autofree(GError) *error = NULL;
autofree(GOptionContext) *context = NULL;
autofree(gchar) *db_path = NULL;
autofree(cve_string) *workdir = NULL;
autofree(CveDB) *cve_db = NULL;
+1 -1
View File
@@ -126,7 +126,7 @@ START_TEST(cve_string_test)
fail_if(cve_string_const_equal(NULL, NULL), "const_equal on NULL string");
/* Forced empty ->str tests */
cve_string st = { .len = 0 };
cve_string st = { 0 };
fail_if(cve_string_equal(&st, &st), "equal on NULL ->str");
fail_if(cve_string_const_equal(&st, "TEST"), "const_equal on NULL ->str");
}