aboutsummaryrefslogtreecommitdiffstats
path: root/search.c
diff options
context:
space:
mode:
authorokan2008-07-11 14:21:28 +0000
committerokan2008-07-11 14:21:28 +0000
commita3e52a291110ce7b866a0d11eeda1619d25f952b (patch)
tree781c99337b95a8386d0e787a95a49bf97148621c /search.c
parentdc3045573c35f2ee31dc1c012da1ff4408b6f264 (diff)
downloadcwm-a3e52a291110ce7b866a0d11eeda1619d25f952b.tar.gz
spacing, declaration lineup to be consistent throughout cwm,
readability, and a bit of knf. ok oga@
Diffstat (limited to '')
-rw-r--r--search.c33
1 files changed, 20 insertions, 13 deletions
diff --git a/search.c b/search.c
index 697c4d9..93d6019 100644
--- a/search.c
+++ b/search.c
@@ -14,7 +14,7 @@
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
- * $Id: search.c,v 1.11 2008/05/20 14:50:51 oga Exp $
+ * $Id: search.c,v 1.12 2008/07/11 14:21:28 okan Exp $
*/
#include "headers.h"
@@ -31,9 +31,11 @@ static int _strsubmatch(char *, char *, int);
void
search_match_client(struct menu_q *menuq, struct menu_q *resultq, char *search)
{
- struct winname *wn;
- struct menu *mi, *tierp[4], *before = NULL;
- int ntiers = sizeof(tierp)/sizeof(tierp[0]);
+ struct winname *wn;
+ struct menu *mi, *tierp[4], *before = NULL;
+ int ntiers;
+
+ ntiers = sizeof(tierp) / sizeof(tierp[0]);
TAILQ_INIT(resultq);
@@ -119,8 +121,10 @@ search_match_client(struct menu_q *menuq, struct menu_q *resultq, char *search)
void
search_print_client(struct menu *mi, int list)
{
- struct client_ctx *cc = mi->ctx;
- char flag = ' ';
+ struct client_ctx *cc;
+ char flag = ' ';
+
+ cc = mi->ctx;
if (cc == client_current())
flag = '!';
@@ -134,9 +138,11 @@ search_print_client(struct menu *mi, int list)
if (!list && cc->matchname != cc->name &&
strlen(mi->print) < sizeof(mi->print) - 1) {
- int diff = sizeof(mi->print) - 1 - strlen(mi->print);
- const char *marker = "";
- char buf[MENU_MAXENTRY + 1];
+ const char *marker = "";
+ char buf[MENU_MAXENTRY + 1];
+ int diff;
+
+ diff = sizeof(mi->print) - 1 - strlen(mi->print);
/* One for the ':' */
diff -= 1;
@@ -157,7 +163,7 @@ search_print_client(struct menu *mi, int list)
void
search_match_text(struct menu_q *menuq, struct menu_q *resultq, char *search)
{
- struct menu *mi;
+ struct menu *mi;
TAILQ_INIT(resultq);
@@ -169,7 +175,7 @@ search_match_text(struct menu_q *menuq, struct menu_q *resultq, char *search)
void
search_match_exec(struct menu_q *menuq, struct menu_q *resultq, char *search)
{
- struct menu *mi;
+ struct menu *mi;
TAILQ_INIT(resultq);
@@ -181,8 +187,8 @@ search_match_exec(struct menu_q *menuq, struct menu_q *resultq, char *search)
static int
_strsubmatch(char *sub, char *str, int zeroidx)
{
- size_t len, sublen;
- u_int n, flen;
+ size_t len, sublen;
+ u_int n, flen;
if (sub == NULL || str == NULL)
return (0);
@@ -197,6 +203,7 @@ _strsubmatch(char *sub, char *str, int zeroidx)
flen = len - sublen;
else
flen = 0;
+
for (n = 0; n <= flen; n++)
if (strncasecmp(sub, str + n, sublen) == 0)
return (1);