[hackers] [dmenu] Untypedef struct item || FRIGN

From: <git_AT_suckless.org>
Date: Mon, 28 Sep 2015 00:38:37 +0200 (CEST)

commit 10fd4f275feaef0b505cc8e65a2deccae69a0968
Author: FRIGN <dev_AT_frign.de>
AuthorDate: Mon Sep 28 00:15:03 2015 +0200
Commit: Hiltjo Posthuma <hiltjo_AT_codemadness.org>
CommitDate: Mon Sep 28 00:33:26 2015 +0200

    Untypedef struct item
    
    Adds clarity. Typedefs for structs are definitely a discussion matter,
    but there's no reason to hide a simple data-structure behind a
    meaningless typedef.

diff --git a/dmenu.c b/dmenu.c
index cf5d976..050b858 100644
--- a/dmenu.c
+++ b/dmenu.c
_AT_@ -28,14 +28,13 @@
 /* enums */
 enum { SchemeNorm, SchemeSel, SchemeOut, SchemeLast }; /* color schemes */
 
-typedef struct Item Item;
-struct Item {
+struct item {
         char *text;
- Item *left, *right;
+ struct item *left, *right;
         bool out;
 };
 
-static void appenditem(Item *, Item **, Item **);
+static void appenditem(struct item *, struct item **, struct item **);
 static void calcoffsets(void);
 static char *cistrstr(const char *, const char *);
 static void cleanup(void);
_AT_@ -56,9 +55,9 @@ static int bh, mw, mh;
 static int sw, sh; /* X display screen geometry width, height */
 static int inputw, promptw;
 static size_t cursor;
-static Item *items = NULL;
-static Item *matches, *matchend;
-static Item *prev, *curr, *next, *sel;
+static struct item *items = NULL;
+static struct item *matches, *matchend;
+static struct item *prev, *curr, *next, *sel;
 static int mon = -1, screen;
 
 static Atom clip, utf8;
_AT_@ -75,7 +74,7 @@ static int (*fstrncmp)(const char *, const char *, size_t) = strncmp;
 static char *(*fstrstr)(const char *, const char *) = strstr;
 
 static void
-appenditem(Item *item, Item **list, Item **last)
+appenditem(struct item *item, struct item **list, struct item **last)
 {
         if (*last)
                 (*last)->right = item;
_AT_@ -135,7 +134,7 @@ static void
 drawmenu(void)
 {
         int curpos;
- Item *item;
+ struct item *item;
         int x = 0, y = 0, h = bh, w;
 
         drw_setscheme(drw, &scheme[SchemeNorm]);
_AT_@ -408,7 +407,7 @@ match(void)
         char buf[sizeof text], *s;
         int i, tokc = 0;
         size_t len;
- Item *item, *lprefix, *lsubstr, *prefixend, *substrend;
+ struct item *item, *lprefix, *lsubstr, *prefixend, *substrend;
 
         strcpy(buf, text);
         /* separate input text into tokens to be matched individually */
Received on Mon Sep 28 2015 - 00:38:37 CEST

This archive was generated by hypermail 2.3.0 : Mon Sep 28 2015 - 00:48:12 CEST