changeset 1067:73aba13ddaed

Removed redundant caller NULL checks already in the API
author Jeremy Henty <onepoint@starurchin.org>
date Sun, 03 May 2009 14:42:26 -0400
parents cab29c7a12c3
children 089ef0db4133
files ChangeLog src/html.cc src/image.cc src/nav.c src/url.c src/web.cc
diffstat 6 files changed, 12 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Sun May 03 14:36:20 2009 -0400
+++ b/ChangeLog	Sun May 03 14:42:26 2009 -0400
@@ -46,6 +46,7 @@
  - Fixed a memory leak in Html_tag_open_link().
  - Fixed a memory leak in Klist().
  - Fix the comment for DLWin::del() (dpi/downloads.cc).
+ - Removed redundant caller NULL checks already in the API.
    Patches: Jeremy Henty
 +- Implemented Basic authentication!
    Patch: Jeremy Henty, Jorge Arellano Cid
--- a/src/html.cc	Sun May 03 14:36:20 2009 -0400
+++ b/src/html.cc	Sun May 03 14:42:26 2009 -0400
@@ -511,8 +511,7 @@
    a_Url_free(base_url);
 
    for (int i = 0; i < cssUrls->size(); i++)
-      if (cssUrls->get(i))
-         a_Url_free(cssUrls->get(i));
+      a_Url_free(cssUrls->get(i));
    delete (cssUrls);
 
    for (int i = 0; i < forms->size(); i++)
@@ -524,15 +523,13 @@
    delete(inputs_outside_form);
 
    for (int i = 0; i < links->size(); i++)
-      if (links->get(i))
-         a_Url_free(links->get(i));
+      a_Url_free(links->get(i));
    delete (links);
 
    for (int i = 0; i < images->size(); i++) {
       DilloLinkImage *li = images->get(i);
       a_Url_free(li->url);
-      if (li->image)
-         a_Image_unref(li->image);
+      a_Image_unref(li->image);
       dFree(li);
    }
    delete (images);
--- a/src/image.cc	Sun May 03 14:36:20 2009 -0400
+++ b/src/image.cc	Sun May 03 14:42:26 2009 -0400
@@ -65,6 +65,7 @@
 
 /*
  * Unref and free if necessary
+ * Do nothing if the argument is NULL
  */
 void a_Image_unref(DilloImage *Image)
 {
@@ -75,6 +76,7 @@
 
 /*
  * Add a reference to an Image struct
+ * Do nothing if the argument is NULL
  */
 void a_Image_ref(DilloImage *Image)
 {
--- a/src/nav.c	Sun May 03 14:36:20 2009 -0400
+++ b/src/nav.c	Sun May 03 14:42:26 2009 -0400
@@ -249,10 +249,8 @@
 void a_Nav_cancel_expect(BrowserWindow *bw)
 {
    if (bw->nav_expecting) {
-      if (bw->nav_expect_url) {
-         a_Url_free(bw->nav_expect_url);
-         bw->nav_expect_url = NULL;
-      }
+      a_Url_free(bw->nav_expect_url);
+      bw->nav_expect_url = NULL;
       bw->nav_expecting = FALSE;
    }
    if (bw->meta_refresh_status > 0)
@@ -416,8 +414,7 @@
    dReturn_if_fail (bw != NULL);
    _MSG(">>> a_Nav_redirection0 <<<<\n");
 
-   if (bw->meta_refresh_url)
-      a_Url_free(bw->meta_refresh_url);
+   a_Url_free(bw->meta_refresh_url);
    bw->meta_refresh_url = a_Url_dup(new_url);
    a_Url_set_flags(bw->meta_refresh_url,
                    URL_FLAGS(new_url)|URL_E2EQuery|URL_IgnoreScroll);
--- a/src/url.c	Sun May 03 14:36:20 2009 -0400
+++ b/src/url.c	Sun May 03 14:42:26 2009 -0400
@@ -190,6 +190,7 @@
 
 /*
  *  Free a DilloUrl
+ *  Do nothing if the argument is NULL
  */
 void a_Url_free(DilloUrl *url)
 {
--- a/src/web.cc	Sun May 03 14:36:20 2009 -0400
+++ b/src/web.cc	Sun May 03 14:42:26 2009 -0400
@@ -139,10 +139,8 @@
 void a_Web_free(DilloWeb *web)
 {
    if (!web) return;
-   if (web->url)
-      a_Url_free(web->url);
-   if (web->Image)
-      a_Image_unref(web->Image);
+   a_Url_free(web->url);
+   a_Image_unref(web->Image);
    dFree(web->filename);
    dList_remove(ValidWebs, (void *)web);
    dFree(web);