From a15d9af3c7f58d671240b23607bb9488a9165eb1 Mon Sep 17 00:00:00 2001
From: mathias <mathias>
Date: Tue, 25 Apr 2006 06:46:06 +0000
Subject: Cleanup unneeded headers (thanks Slava Semushin)

---
 ChangeLog           |  3 +++
 src/FbAtoms.cc      |  5 -----
 src/FbTk/App.cc     |  5 -----
 src/FocusControl.cc |  2 +-
 src/Keys.cc         |  5 -----
 src/Slit.cc         |  5 -----
 util/fbrun/FbRun.cc | 62 ++++++++++++++++++++++++++---------------------------
 7 files changed, 34 insertions(+), 53 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 13e866e..3306f27 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,9 @@
 (Format: Year/Month/Day)
 Changes for 0.9.16:
 *06/04/25:
+   * Cleanup unneeded headers (thanks Slava Semushin)
+     FbAtoms.cc Slit.cc Keys.cc FocusControl.cc FbTk/App.cc
+     util/fbrun/FbRun.cc
    * Fix occasional highlighting of menu nops+separators, sf.net patch 
      #1475268 (thanks Scott Kuhl; skuhl AT cs utah edu)
      FbTk/MenuSeparator.hh/cc FbTk/Menu.cc MenuCreator.cc
diff --git a/src/FbAtoms.cc b/src/FbAtoms.cc
index 6a67cdf..5314538 100644
--- a/src/FbAtoms.cc
+++ b/src/FbAtoms.cc
@@ -25,11 +25,6 @@
 #include "App.hh"
 
 #include <string>
-#ifdef HAVE_CASSERT
-  #include <cassert>
-#else
-  #include <assert.h>
-#endif
 
 using namespace std;
 
diff --git a/src/FbTk/App.cc b/src/FbTk/App.cc
index 1ef5aed..11bea9b 100644
--- a/src/FbTk/App.cc
+++ b/src/FbTk/App.cc
@@ -25,11 +25,6 @@
 
 #include "EventManager.hh"
 
-#ifdef HAVE_CASSERT
-  #include <cassert>
-#else
-  #include <assert.h>
-#endif
 #include <string>
 
 namespace FbTk {
diff --git a/src/FocusControl.cc b/src/FocusControl.cc
index f7ed962..e92eced 100644
--- a/src/FocusControl.cc
+++ b/src/FocusControl.cc
@@ -31,8 +31,8 @@
 #include "FbWinFrameTheme.hh"
 
 #include <string>
-#include <cassert>
 #include <iostream>
+
 using std::cerr;
 using std::endl;
 using std::string;
diff --git a/src/Keys.cc b/src/Keys.cc
index 78ad912..c6276c5 100644
--- a/src/Keys.cc
+++ b/src/Keys.cc
@@ -87,11 +87,6 @@
 #include <fstream>
 #include <vector>
 #include <map>
-#ifdef HAVE_CASSERT
-  #include <cassert>
-#else
-  #include <assert.h>
-#endif
 #include <memory>
 
 using namespace std;
diff --git a/src/Slit.cc b/src/Slit.cc
index db2deae..15b171f 100644
--- a/src/Slit.cc
+++ b/src/Slit.cc
@@ -67,11 +67,6 @@
 
 #include <algorithm>
 #include <iostream>
-#ifdef HAVE_CASSERT
-  #include <cassert>
-#else
-  #include <assert.h>
-#endif
 
 #ifdef HAVE_SYS_STAT_H
 #include <sys/types.h>
diff --git a/util/fbrun/FbRun.cc b/util/fbrun/FbRun.cc
index 7392083..c175e67 100644
--- a/util/fbrun/FbRun.cc
+++ b/util/fbrun/FbRun.cc
@@ -48,13 +48,9 @@
 #include <iterator>
 #include <fstream>
 #include <algorithm>
-#ifdef HAVE_CASSERT
-  #include <cassert>
-#else
-  #include <assert.h>
-#endif
 
 using namespace std;
+
 FbRun::FbRun(int x, int y, size_t width):
     FbTk::TextBox(DefaultScreen(FbTk::App::instance()->display()),
                   m_font, ""),
@@ -67,7 +63,7 @@ FbRun::FbRun(int x, int y, size_t width):
     m_last_completion_prefix(""),
     m_current_apps_item(0),
     m_cursor(XCreateFontCursor(FbTk::App::instance()->display(), XC_xterm)) {
-    
+
     setGC(m_gc.gc());
     setCursor(m_cursor);
     // setting nomaximize in local resize
@@ -78,9 +74,9 @@ FbRun::FbRun(int x, int y, size_t width):
     if (class_hint == 0)
         throw string("Out of memory");
     class_hint->res_name = "fbrun";
-    class_hint->res_class = "FbRun";    
+    class_hint->res_class = "FbRun";
     XSetClassHint(m_display, window(), class_hint);
-    
+
     XFree(class_hint);
 #ifdef HAVE_XPM
     Pixmap mask = 0;
@@ -123,7 +119,7 @@ void FbRun::run(const std::string &command) {
     }
 
     hide(); // hide gui
-    
+
     // save command history to file
     if (text().size() != 0) { // no need to save empty command
 
@@ -134,7 +130,7 @@ void FbRun::run(const std::string &command) {
             // m_current_history_item is the duplicate
         } else {
             m_current_history_item = 0;
-            for (; m_current_history_item < m_history.size(); 
+            for (; m_current_history_item < m_history.size();
                  ++m_current_history_item) {
                 if (m_history[m_current_history_item] == text())
                     break;
@@ -154,7 +150,7 @@ void FbRun::run(const std::string &command) {
                 // write the history items that come after current
                 for (i++; i < m_history.size(); i++)
                     inoutfile<<m_history[i]<<endl;
-                
+
             } else {
                 // set put-pointer at end of file
                 inoutfile.seekp(0, ios::end);
@@ -215,7 +211,7 @@ void FbRun::setTitle(const string &title) {
 }
 
 void FbRun::resize(unsigned int width, unsigned int height) {
-    FbTk::TextBox::resize(width, height);    
+    FbTk::TextBox::resize(width, height);
 }
 
 void FbRun::redrawLabel() {
@@ -233,7 +229,7 @@ void FbRun::keyPressEvent(XKeyEvent &ke) {
     char keychar[1];
     XLookupString(&ke, keychar, 1, &ks, 0);
     // a modifier key by itself doesn't do anything
-    if (IsModifierKey(ks)) 
+    if (IsModifierKey(ks))
         return;
 
     if (FbTk::KeyUtil::instance().isolateModifierMask(ke.state)) { // a modifier key is down
@@ -374,7 +370,7 @@ void FbRun::tabCompleteHistory() {
 }
 
 void FbRun::tabCompleteApps() {
-  
+
     static bool first_run= true;
     if (m_last_completion_prefix.empty())
         m_last_completion_prefix = text().substr(0, textStartPos() + cursorPosition());
@@ -387,19 +383,21 @@ void FbRun::tabCompleteApps() {
     // (re)build m_apps-container
     if (first_run || m_last_completion_prefix != prefix) {
         first_run= false;
-        
+
         string path;
-        
-        if(!prefix.empty() && 
+
+        if(!prefix.empty() &&
             string("/.~").find_first_of(prefix[0]) != string::npos) {
             size_t rseparator= prefix.find_last_of("/");
             path= prefix.substr(0, rseparator + 1) +  ":";
             add_dirs= true;
-        } else
-            path= getenv("PATH");
-
+        } else {
+            char* tmp_path = getenv("PATH");
+            if (tmp_path)
+                path = tmp_path;
+        }
         m_apps.clear();
-        
+
         unsigned int l;
         unsigned int r;
 
@@ -412,27 +410,27 @@ void FbRun::tabCompleteApps() {
                 if (n >= 0) {
                     while(n--) {
                         filename= dir.readFilename();
-                        fncomplete= dir.name() + 
-                                    (*dir.name().rbegin() != '/' ? "/" : "") + 
+                        fncomplete= dir.name() +
+                                    (*dir.name().rbegin() != '/' ? "/" : "") +
                                     filename;
 
                         // directories in dirmode ?
                         if (add_dirs && FbTk::FileUtil::isDirectory(fncomplete.c_str()) &&
                             filename != ".." && filename != ".") {
-                            m_apps.push_back(fncomplete); 
+                            m_apps.push_back(fncomplete);
                         // executables in dirmode ?
-                        } else if (add_dirs && FbTk::FileUtil::isRegularFile(fncomplete.c_str()) && 
-                                   FbTk::FileUtil::isExecutable(fncomplete.c_str()) && 
-                                   (prefix == "" || 
+                        } else if (add_dirs && FbTk::FileUtil::isRegularFile(fncomplete.c_str()) &&
+                                   FbTk::FileUtil::isExecutable(fncomplete.c_str()) &&
+                                   (prefix == "" ||
                                     fncomplete.substr(0, prefix.size()) == prefix)) {
                             m_apps.push_back(fncomplete);
                         // executables in $PATH ?
-                        } else if (FbTk::FileUtil::isRegularFile(fncomplete.c_str()) && 
-                                   FbTk::FileUtil::isExecutable(fncomplete.c_str()) && 
-                                   (prefix == "" || 
+                        } else if (FbTk::FileUtil::isRegularFile(fncomplete.c_str()) &&
+                                   FbTk::FileUtil::isExecutable(fncomplete.c_str()) &&
+                                   (prefix == "" ||
                                     filename.substr(0, prefix.size()) == prefix)) {
                             m_apps.push_back(filename);
-                        } 
+                        }
                     }
                 }
                 l= r + 1;
@@ -473,7 +471,7 @@ void FbRun::tabCompleteApps() {
             }
             apps_item++;
         }
-        if (!changed_prefix && apps_item == m_current_apps_item) 
+        if (!changed_prefix && apps_item == m_current_apps_item)
             XBell(m_display, 0);
     }
 }
-- 
cgit v0.11.2