]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Removed useless MimeIcon::_free and some useless whitespace
authorFrancesco Chemolli <kinkie@squid-cache.org>
Sat, 2 Feb 2013 11:36:38 +0000 (12:36 +0100)
committerFrancesco Chemolli <kinkie@squid-cache.org>
Sat, 2 Feb 2013 11:36:38 +0000 (12:36 +0100)
src/mime.cc

index dbc98b7d7772c9e6fc1eb20e79d94b6418a72e1a..9ec45f3ce785e763f76bcc2820ede382a5a70046 100644 (file)
@@ -42,7 +42,6 @@
 #include "Mem.h"
 #include "MemBuf.h"
 #include "mime.h"
-#include "MemObject.h"
 #include "RequestFlags.h"
 #include "SquidConfig.h"
 #include "Store.h"
@@ -66,12 +65,11 @@ public:
     ~MimeIcon ();
     void setName (char const *);
     char const * getName () const;
-    void _free();
     void load();
     void created (StoreEntry *newEntry);
 
 private:
-    char *icon;
+    const char *icon;
     char *url;
 };
 
@@ -181,7 +179,8 @@ MimeIcon::MimeIcon () : icon (NULL), url (NULL)
 
 MimeIcon::~MimeIcon ()
 {
-    _free();
+    safe_free (icon);
+    safe_free (url);
 }
 
 void
@@ -199,13 +198,6 @@ MimeIcon::getName () const
     return icon;
 }
 
-void
-MimeIcon::_free()
-{
-    safe_free (icon);
-    safe_free (url);
-}
-
 char const *
 mimeGetIcon(const char *fn)
 {
@@ -430,34 +422,28 @@ MimeIcon::load()
 void
 MimeIcon::created (StoreEntry *newEntry)
 {
-    /* is already in the store, do nothing */
-
+    /* if the icon is already in the store, do nothing */
     if (!newEntry->isNull())
         return;
 
     int fd;
-
     int n;
-
     RequestFlags flags;
-
     struct stat sb;
-
     LOCAL_ARRAY(char, path, MAXPATHLEN);
-
     char *buf;
 
     snprintf(path, MAXPATHLEN, "%s/%s", Config.icons.directory, icon);
 
     fd = file_open(path, O_RDONLY | O_BINARY);
-
     if (fd < 0) {
-        debugs(25, DBG_CRITICAL, "mimeLoadIconFile: " << path << ": " << xstrerror());
+        debugs(25, DBG_CRITICAL, "mimeLoadIconFile: " << path << ": "
+                        << xstrerror());
         return;
     }
-
     if (fstat(fd, &sb) < 0) {
-        debugs(25, DBG_CRITICAL, "mimeLoadIconFile: FD " << fd << ": fstat: " << xstrerror());
+        debugs(25, DBG_CRITICAL, "mimeLoadIconFile: FD " << fd << ": fstat: "
+                        << xstrerror());
         file_close(fd);
         return;
     }
@@ -477,33 +463,23 @@ MimeIcon::created (StoreEntry *newEntry)
 
     HttpReply *reply = new HttpReply;
 
-    reply->setHeaders(HTTP_OK, NULL, mimeGetContentType(icon), sb.st_size, sb.st_mtime, -1);
-
+    reply->setHeaders(HTTP_OK, NULL, mimeGetContentType(icon), sb.st_size,
+                    sb.st_mtime, -1);
     reply->cache_control = new HttpHdrCc();
-
     reply->cache_control->maxAge(86400);
-
     reply->header.putCc(reply->cache_control);
-
     e->replaceHttpReply(reply);
 
     /* read the file into the buffer and append it to store */
     buf = (char *)memAllocate(MEM_4K_BUF);
-
     while ((n = FD_READ_METHOD(fd, buf, 4096)) > 0)
         e->append(buf, n);
 
     file_close(fd);
-
     e->flush();
-
     e->complete();
-
     e->timestampsSet();
-
-    debugs(25, 3, "Loaded icon " << url);
-
     e->unlock();
-
     memFree(buf, MEM_4K_BUF);
+    debugs(25, 3, "Loaded icon " << url);
 }