From 88be07272f2845bc8e61a775dcc25b80173565c9 Mon Sep 17 00:00:00 2001 From: Pavel Borzenkov Date: Wed, 19 Oct 2011 07:44:36 -0400 Subject: [PATCH] There is no need to check return value of g_malloc() It never returns NULL. If this function fails, the application is terminated. Signed-off-by: Pavel Borzenkov Signed-off-by: Sebastian Ramacher --- database-plain.c | 3 --- database-sqlite.c | 6 ------ document.c | 7 ------- zathura.c | 4 ---- 4 files changed, 20 deletions(-) diff --git a/database-plain.c b/database-plain.c index f9ce9d4..0bb5513 100644 --- a/database-plain.c +++ b/database-plain.c @@ -211,9 +211,6 @@ zathura_db_load_bookmarks(zathura_database_t* db, const char* file) for (gsize i = 0; i < length; i++) { zathura_bookmark_t* bookmark = g_malloc0(sizeof(zathura_bookmark_t)); - if (bookmark == NULL) { - continue; - } bookmark->id = g_strdup(keys[i]); bookmark->page = g_key_file_get_integer(db->bookmarks, file, keys[i], NULL); diff --git a/database-sqlite.c b/database-sqlite.c index d613b84..779cc32 100644 --- a/database-sqlite.c +++ b/database-sqlite.c @@ -26,9 +26,6 @@ zathura_db_init(const char* dir) } zathura_database_t* db = g_malloc0(sizeof(zathura_database_t)); - if (db == NULL) { - goto error_free; - } /* create bookmarks database */ static const char SQL_BOOKMARK_INIT[] = @@ -188,9 +185,6 @@ zathura_db_load_bookmarks(zathura_database_t* db, const char* file) while (sqlite3_step(stmt) == SQLITE_ROW) { zathura_bookmark_t* bookmark = g_malloc0(sizeof(zathura_bookmark_t)); - if (bookmark == NULL) { - continue; - } bookmark->id = g_strdup((const char*) sqlite3_column_text(stmt, 0)); bookmark->page = sqlite3_column_int(stmt, 1); diff --git a/document.c b/document.c index daf349a..cb1c441 100644 --- a/document.c +++ b/document.c @@ -212,9 +212,6 @@ zathura_document_open(zathura_t* zathura, const char* path, const char* password } document = g_malloc0(sizeof(zathura_document_t)); - if (document == NULL) { - goto error_free; - } document->file_path = real_path; document->password = password; @@ -497,10 +494,6 @@ zathura_index_element_new(const char* title) zathura_index_element_t* res = g_malloc0(sizeof(zathura_index_element_t)); - if (res == NULL) { - return NULL; - } - res->title = g_strdup(title); return res; diff --git a/zathura.c b/zathura.c index 59ef362..b0fe85d 100644 --- a/zathura.c +++ b/zathura.c @@ -54,10 +54,6 @@ zathura_init(int argc, char* argv[]) zathura_t* zathura = g_malloc0(sizeof(zathura_t)); - if (zathura == NULL) { - return NULL; - } - /* general */ zathura->document = NULL;