[hackers] wmii: new tip (= 1734)

From: Anselm R. Garbe <arg_AT_suckless.org>
Date: Mon, 05 Feb 2007 03:10:04 +0100

changeset: 1734:bd78bc98b117
tag: tip
user: Kris Maglione <jg_AT_suckless.org>
date: Sun Feb 04 21:02:05 2007 -0500
files: area.c bar.c client.c column.c draw.c fs.c key.c main.c mouse.c rule.c view.c wmii.h
description:
Replaced nasty, eyesore NULL with nil

diff -r 6af6ee314a62 -r bd78bc98b117 area.c
--- a/area.c Sun Feb 04 20:57:28 2007 -0500
+++ b/area.c Sun Feb 04 21:02:05 2007 -0500
@@ -9,7 +9,7 @@
 
 Client *
 sel_client_of_area(Area *a) {
- return a && a->sel ? a->sel->client : NULL;
+ return a && a->sel ? a->sel->client : nil;
 }
 
 Area *
@@ -32,7 +32,7 @@ create_area(View *v, Area *pos, unsigned
         if(w < min_width)
                 w = min_width;
         if(col_num && col_num * min_width + w > screen->rect.width)
- return NULL;
+ return nil;
         if(area_num > 1)
                 scale_view(v, screen->rect.width - w);
         a = ixp_emallocz(sizeof(Area));
@@ -42,8 +42,8 @@ create_area(View *v, Area *pos, unsigned
         a->rect.height = screen->rect.height - screen->brect.height;
         a->mode = def.colmode;
         a->rect.width = w;
- a->frame = NULL;
- a->sel = NULL;
+ a->frame = nil;
+ a->sel = nil;
         a->next = *p;
         *p = a;
         v->sel = a;
@@ -64,10 +64,10 @@ destroy_area(Area *a) {
         unsigned int i;
         assert(!a->frame && "wmiiwm: fatal, destroying non-empty area");
         if(v->revert == a)
- v->revert = NULL;
+ v->revert = nil;
         for(c=client; c; c=c->next)
                 if(c->revert == a)
- c->revert = NULL;
+ c->revert = nil;
         for(ta=v->area, i = 0; ta && ta->next != a; ta=ta->next, i++);
         if(ta) {
                 ta->next = a->next;
@@ -83,7 +83,7 @@ static void
 static void
 place_client(Area *a, Client *c) {
         static unsigned int mx, my;
- static Bool *field = NULL;
+ static Bool *field = nil;
         Frame *fr;
         Bool fit = False;
         BlitzAlign align = CENTER;
@@ -218,7 +218,7 @@ attach_to_area(Area *a, Frame *f, Bool s
 
 void
 detach_from_area(Area *a, Frame *f) {
- Frame **ft, *pr = NULL;
+ Frame **ft, *pr = nil;
         Client *c = f->client;
         View *v = a->view;
         Area *ta;
@@ -305,7 +305,7 @@ select_area(Area *a, char *arg) {
                 if(v == screen->sel)
                         focus_view(screen, v);
                 flush_masked_events(EnterWindowMask);
- return NULL;
+ return nil;
         }
         else if(!strncmp(arg, "down", 5)) {
                 if(!f)
@@ -316,7 +316,7 @@ select_area(Area *a, char *arg) {
                 if(v == screen->sel)
                         focus_view(screen, v);
                 flush_masked_events(EnterWindowMask);
- return NULL;
+ return nil;
         }
         else {
                 if(sscanf(arg, "%d", &i) != 1)
@@ -333,5 +333,5 @@ select_area(Area *a, char *arg) {
         }
         if(a->floating != new->floating)
                 v->revert = a;
- return NULL;
-}
+ return nil;
+}
diff -r 6af6ee314a62 -r bd78bc98b117 bar.c
--- a/bar.c Sun Feb 04 20:57:28 2007 -0500
+++ b/bar.c Sun Feb 04 21:02:05 2007 -0500
@@ -6,7 +6,7 @@
 #include <string.h>
 #include <stdlib.h>
 
-Bar *free_bars = NULL;
+Bar *free_bars = nil;
 
 Bar *
 create_bar(Bar **b_link, char *name) {
@@ -68,7 +68,7 @@ draw_bar(WMScreen *s) {
         draw_tile(&s->bbrush);
         if(!s->lbar && !s->rbar)
                 goto MapBar;
- largest = b = tb = NULL;
+ largest = b = tb = nil;
         tw = width = nb = size = 0;
         for(b=s->lbar, nb=2 ;nb; --nb && (b = s->rbar))
                 for(; b; b=b->next) {
@@ -100,7 +100,7 @@ draw_bar(WMScreen *s) {
                 for(b=largest; b != tb->smaller; b=b->smaller)
                         b->brush.rect.width = floor(b->brush.rect.width * shrink);
                 width += tw * shrink;
- tb=NULL;
+ tb=nil;
         }
         for(b=s->lbar, nb=2 ;nb; b=s->rbar, nb--)
                 for(; b; tb = b, b=b->next) {
diff -r 6af6ee314a62 -r bd78bc98b117 client.c
--- a/client.c Sun Feb 04 20:57:28 2007 -0500
+++ b/client.c Sun Feb 04 21:02:05 2007 -0500
@@ -14,7 +14,7 @@ static char *Ebadcmd = "bad command",
 
 Client *
 sel_client() {
- return screen->sel && screen->sel->sel->sel ? screen->sel->sel->sel->client : NULL;
+ return screen->sel && screen->sel->sel->sel ? screen->sel->sel->sel->client : nil;
 }
 
 Client *
@@ -28,7 +28,7 @@ frame_of_win(Window w) {
 frame_of_win(Window w) {
         Client *c;
         for(c=client; c && c->framewin != w; c=c->next);
- return c ? c->frame : NULL;
+ return c ? c->frame : nil;
 }
 
 static void
@@ -36,7 +36,7 @@ update_client_name(Client *c) {
         XTextProperty name;
         XClassHint ch;
         int n;
- char **list = NULL;
+ char **list = nil;
 
         name.nitems = 0;
         c->name[0] = 0;
@@ -107,7 +107,7 @@ create_client(Window w, XWindowAttribute
         c->gc = XCreateGC(blz.dpy, c->framewin, 0, 0);
         XSync(blz.dpy, False);
         for(t=&client; *t; t=&(*t)->next);
- c->next = *t; /* *t == NULL */
+ c->next = *t; /* *t == nil */
         *t = c;
         write_event("CreateClient 0x%x\n", c->win);
         return c;
@@ -372,7 +372,7 @@ dummy_error_handler(Display *dpy, XError
 
 void
 destroy_client(Client *c) {
- char *dummy = NULL;
+ char *dummy = nil;
         Client **tc;
 
         XGrabServer(blz.dpy);
@@ -543,7 +543,7 @@ move_client(Client *c, char *arg) {
         new.x += x;
         new.y += y;
         if(!f->area->floating)
- resize_column(f->client, &new, NULL);
+ resize_column(f->client, &new, nil);
         else
                 resize_client(f->client, &new, False);
 }
@@ -559,7 +559,7 @@ size_client(Client *c, char *arg) {
         new.width += w;
         new.height += h;
         if(!f->area->floating)
- resize_column(f->client, &new, NULL);
+ resize_column(f->client, &new, nil);
         else
                 resize_client(f->client, &new, False);
 }
@@ -634,7 +634,7 @@ send_client(Frame *f, char *arg) {
                 focus_client(f->client, False);
                 focus_view(screen, f->view);
         }
- return NULL;
+ return nil;
 }
 
 /* convenience function */
@@ -701,7 +701,7 @@ apply_tags(Client *c, const char *tags)
                 if(!strncmp(toks[i], "~", 2))
                         c->floating = True;
                 else if(!strncmp(toks[i], "!", 2))
- toks[j++] = view ? screen->sel->name : "NULL";
+ toks[j++] = view ? screen->sel->name : "nil";
                 else if(strncmp(toks[i], "sel", 4)
                                 && strncmp(toks[i], ".", 2)
                                 && strncmp(toks[i], "..", 3))
@@ -720,7 +720,7 @@ apply_tags(Client *c, const char *tags)
                         len -= strlen(c->tags);
                         toks[n++] = toks[i];
                 }
- toks[n] = NULL;
+ toks[n] = nil;
         update_client_views(c, toks);
         XChangeProperty(blz.dpy, c->win, tags_atom, XA_STRING, 8,
                         PropModeReplace, (unsigned char *)c->tags, strlen(c->tags));
@@ -733,7 +733,7 @@ match_tags(Client *c, const char *prop)
 
         for(r=def.tagrules.rule; r; r=r->next)
                 if(!regexec(&r->regex, prop, 1, &tmpregm, 0))
- if(!strlen(c->tags) || !strncmp(c->tags, "NULL", 4))
+ if(!strlen(c->tags) || !strncmp(c->tags, "nil", 4))
                                 apply_tags(c, r->value);
 }
 
@@ -742,14 +742,14 @@ apply_rules(Client *c) {
         if(def.tagrules.string)
                 match_tags(c, c->props);
         if(!strlen(c->tags))
- apply_tags(c, "NULL");
+ apply_tags(c, "nil");
 }
 
 char *
 message_client(Client *c, char *message) {
         if(!strncmp(message, "kill", 5)) {
                 kill_client(c);
- return NULL;
+ return nil;
         }
         return Ebadcmd;
 }
diff -r 6af6ee314a62 -r bd78bc98b117 column.c
--- a/column.c Sun Feb 04 20:57:28 2007 -0500
+++ b/column.c Sun Feb 04 21:02:05 2007 -0500
@@ -27,7 +27,7 @@ str_of_column_mode(int mode) {
         case Colmax: return "max"; break;
         default: break;
         }
- return NULL;
+ return nil;
 }
 
 int
@@ -216,9 +216,9 @@ match_horiz(Area *a, XRectangle *r) {
 
 static void
 drop_resize(Frame *f, XRectangle *new) {
- Area *west = NULL, *east = NULL, *a = f->area;
+ Area *west = nil, *east = nil, *a = f->area;
         View *v = a->view;
- Frame *north = NULL, *south = NULL;
+ Frame *north = nil, *south = nil;
         unsigned int min_height = 2 * labelh(&def.font);
         unsigned int min_width = screen->rect.width/NCOL;
 
@@ -317,10 +317,10 @@ frame_of_point(XPoint *pt) {
 frame_of_point(XPoint *pt) {
         Area *a;
         View *v = screen->sel;
- Frame *f = NULL;
+ Frame *f = nil;
 
         if(!v)
- return NULL;
+ return nil;
         for(a=v->area->next; a && !ispointinrect(pt->x, pt->y, &a->rect);
                 a=a->next);
         if(a)
@@ -340,7 +340,7 @@ drop_move(Frame *f, XRectangle *nrect) {
 
         v = f->view;
         high = 0;
- a_high = NULL;
+ a_high = nil;
 
         for(a = v->area->next; a; a = a->next) {
                 arect = &a->rect;
@@ -414,7 +414,7 @@ drop_move_old(Frame *f, XRectangle *new,
         Frame *ft;
         View *v;
 
- tgt = NULL;
+ tgt = nil;
         src = f->area;
         v = src->view;
         if(!pt)
@@ -479,7 +479,7 @@ new_column(View *v, Area *pos, unsigned
 new_column(View *v, Area *pos, unsigned int w) {
         Area *a = create_area(v, pos, w);
         if(!a)
- return NULL;
+ return nil;
         arrange_view(v);
         return a;
 }
diff -r 6af6ee314a62 -r bd78bc98b117 draw.c
--- a/draw.c Sun Feb 04 20:57:28 2007 -0500
+++ b/draw.c Sun Feb 04 21:02:05 2007 -0500
@@ -10,7 +10,7 @@ textwidth_l(BlitzFont *font, char *text,
 textwidth_l(BlitzFont *font, char *text, unsigned int len) {
         if(font->set) {
                 XRectangle r;
- XmbTextExtents(font->set, text, len, NULL, &r);
+ XmbTextExtents(font->set, text, len, nil, &r);
                 return r.width;
         }
         return XTextWidth(font->xfont, text, len);
@@ -24,7 +24,7 @@ void
 void
 loadfont(Blitz *blitz, BlitzFont *font) {
         char *fontname = font->fontstr;
- char **missing = NULL, *def = "?";
+ char **missing = nil, *def = "?";
         int n;
 
         if(font->set)
@@ -54,7 +54,7 @@ loadfont(Blitz *blitz, BlitzFont *font)
         else {
                 if(font->xfont)
                         XFreeFont(blitz->dpy, font->xfont);
- font->xfont = NULL;
+ font->xfont = nil;
                 font->xfont = XLoadQueryFont(blitz->dpy, fontname);
                 if (!font->xfont) {
                         fprintf(stderr, "%s", "wmii: error, cannot load 'fixed' font\n");
@@ -224,5 +224,5 @@ parse_colors(char **buf, int *buflen, Bl
                 (*buf)++;
                 (*buflen)--;
         }
- return NULL;
-}
+ return nil;
+}
diff -r 6af6ee314a62 -r bd78bc98b117 fs.c
--- a/fs.c Sun Feb 04 20:57:28 2007 -0500
+++ b/fs.c Sun Feb 04 21:02:05 2007 -0500
@@ -70,8 +70,8 @@ static char
 
 /* Global Vars */
 /***************/
-FileId *free_fileid = NULL;
-P9Req *pending_event_reads = NULL;
+FileId *free_fileid = nil;
+P9Req *pending_event_reads = nil;
 FidLink *pending_event_fids;
 P9Srv p9srv = {
         .open= fs_open,
@@ -100,25 +100,25 @@ dirtab_root[]= {{".", P9QTDIR, FsRoot,
                   {"event", P9QTFILE, FsFEvent, 0600 },
                   {"keys", P9QTFILE, FsFKeys, 0600 },
                   {"tagrules", P9QTFILE, FsFTagRules, 0600 },
- {NULL}},
+ {nil}},
 dirtab_clients[]={{".", P9QTDIR, FsDClients, 0500|P9DMDIR },
                   {"", P9QTDIR, FsDClient, 0500|P9DMDIR },
- {NULL}},
+ {nil}},
 dirtab_client[]= {{".", P9QTDIR, FsDClient, 0500|P9DMDIR },
                   {"ctl", P9QTAPPEND, FsFCctl, 0600|P9DMAPPEND },
                   {"tags", P9QTFILE, FsFCtags, 0600 },
                   {"props", P9QTFILE, FsFprops, 0400 },
- {NULL}},
+ {nil}},
 dirtab_bars[]= {{".", P9QTDIR, FsDBars, 0700|P9DMDIR },
                   {"", P9QTFILE, FsFBar, 0600 },
- {NULL}},
+ {nil}},
 dirtab_tags[]= {{".", P9QTDIR, FsDTags, 0500|P9DMDIR },
                   {"", P9QTDIR, FsDTag, 0500|P9DMDIR },
- {NULL}},
+ {nil}},
 dirtab_tag[]= {{".", P9QTDIR, FsDTag, 0500|P9DMDIR },
                   {"ctl", P9QTAPPEND, FsFTctl, 0600|P9DMAPPEND },
                   {"index", P9QTFILE, FsFTindex, 0400 },
- {NULL}};
+ {nil}};
 /* Writing the lists separately and using an array of their references
  * removes the need for casting and allows for C90 conformance,
  * since otherwise we would need to use compound literals */
@@ -151,7 +151,7 @@ get_file() {
         temp = free_fileid;
         free_fileid = temp->next;
         temp->nref = 1;
- temp->next = NULL;
+ temp->next = nil;
         return temp;
 }
 
@@ -279,7 +279,7 @@ message_root(char *message)
         }
         else
                 return Ebadcmd;
- return NULL;
+ return nil;
 }
 
 char *
@@ -303,8 +303,8 @@ respond_event(P9Req *r) {
         if(f->content.buf) {
                 r->ofcall.data.rread.data = (void *)f->content.buf;
                 r->ofcall.data.rread.count = strlen(f->content.buf);
- respond(r, NULL);
- f->content.buf = NULL;
+ respond(r, nil);
+ f->content.buf = nil;
         }else{
                 r->aux = pending_event_reads;
                 pending_event_reads = r;
@@ -345,8 +345,8 @@ dostat(Stat *s, unsigned int len, FileId
         s->qid.version = 0;
         s->qid.type = f->tab.qtype;
         s->mode = f->tab.perm;
- s->atime = time(NULL);
- s->mtime = time(NULL);
+ s->atime = time(nil);
+ s->mtime = time(nil);
         s->length = len;
         s->name = f->tab.name;
         s->uid = user;
@@ -369,10 +369,10 @@ lookup_file(FileId *parent, char *name)
         unsigned int id;
 
         if(!(parent->tab.perm & P9DMDIR))
- return NULL;
+ return nil;
         dir = dirtab[parent->tab.type];
         last = &ret;
- ret = NULL;
+ ret = nil;
         for(; dir->name; dir++) {
                 /* Dynamic dirs */
                 if(!*dir->name) { /* strlen(dir->name) == 0 */
@@ -479,7 +479,7 @@ lookup_file(FileId *parent, char *name)
                 continue;
         }
 LastItem:
- *last = NULL;
+ *last = nil;
         return ret;
 }
 
@@ -490,12 +490,12 @@ fs_attach(P9Req *r) {
         FileId *f = get_file();
         f->tab = dirtab[FsRoot][0];
         f->tab.name = ixp_estrdup("/");
- f->content.ref = NULL; /* shut up valgrind */
+ f->content.ref = nil; /* shut up valgrind */
         r->fid->aux = f;
         r->fid->qid.type = f->tab.qtype;
         r->fid->qid.path = QID(f->tab.type, 0);
         r->ofcall.data.rattach.qid = r->fid->qid;
- respond(r, NULL);
+ respond(r, nil);
 }
 
 void
@@ -547,7 +547,7 @@ fs_walk(P9Req *r) {
         }
         r->newfid->aux = f;
         r->ofcall.data.rwalk.nwqid = i;
- respond(r, NULL);
+ respond(r, nil);
 }
 
 unsigned int
@@ -578,7 +578,7 @@ fs_stat(P9Req *r) {
         buf = ixp_emallocz(size);
         r->ofcall.data.rstat.stat = buf;
         ixp_pack_stat(&buf, &size, &s);
- respond(r, NULL);
+ respond(r, nil);
 }
 
 void
@@ -596,7 +596,7 @@ fs_read(P9Req *r) {
                 size = r->ifcall.data.tread.count;
                 buf = ixp_emallocz(size);
                 r->ofcall.data.rread.data = buf;
- tf = f = lookup_file(f, NULL);
+ tf = f = lookup_file(f, nil);
                 /* Note: f->tab.name == "." so we skip it */
                 for(f=f->next; f; f=f->next) {
                         dostat(&s, fs_size(f), f);
@@ -613,57 +613,57 @@ fs_read(P9Req *r) {
                         free_file(f);
                 }
                 r->ofcall.data.rread.count = r->ifcall.data.tread.count - size;
- respond(r, NULL);
+ respond(r, nil);
                 return;
         }
         else{
                 switch(f->tab.type) {
                 case FsFprops:
                         write_buf(r, (void *)f->content.client->props, strlen(f->content.client->props));
- respond(r, NULL);
+ respond(r, nil);
                         return;
                 case FsFColRules:
                 case FsFTagRules:
                         write_buf(r, (void *)f->content.rule->string, f->content.rule->size);
- respond(r, NULL);
+ respond(r, nil);
                         return;
                 case FsFKeys:
                         write_buf(r, (void *)def.keys, def.keyssz);
- respond(r, NULL);
+ respond(r, nil);
                         return;
                 case FsFCtags:
                         write_buf(r, (void *)f->content.client->tags, strlen(f->content.client->tags));
- respond(r, NULL);
+ respond(r, nil);
                         return;
                 case FsFTctl:
                         write_buf(r, (void *)f->content.view->name, strlen(f->content.view->name));
- respond(r, NULL);
+ respond(r, nil);
                         return;
                 case FsFBar:
                         write_buf(r, (void *)f->content.bar->buf, strlen(f->content.bar->buf));
- respond(r, NULL);
+ respond(r, nil);
                         return;
                 case FsFRctl:
                         buf = read_root_ctl();
                         write_buf(r, buf, strlen(buf));
- respond(r, NULL);
+ respond(r, nil);
                         return;
                 case FsFCctl:
                         if(r->ifcall.data.tread.offset) {
- respond(r, NULL);
+ respond(r, nil);
                                 return;
                         }
                         r->ofcall.data.rread.data = ixp_emallocz(16);
                         n = snprintf(r->ofcall.data.rread.data, 16, "0x%x", (unsigned int)f->index);
                         assert(n >= 0);
                         r->ofcall.data.rread.count = n;
- respond(r, NULL);
+ respond(r, nil);
                         return;
                 case FsFTindex:
                         buf = (char *)view_index(f->content.view);
                         n = strlen(buf);
                         write_buf(r, (void *)buf, n);
- respond(r, NULL);
+ respond(r, nil);
                         return;
                 case FsFEvent:
                         respond_event(r);
@@ -679,11 +679,11 @@ void
 void
 fs_write(P9Req *r) {
         FileId *f;
- char *errstr = NULL;
+ char *errstr = nil;
         unsigned int i;
 
         if(r->ifcall.data.twrite.count == 0) {
- respond(r, NULL);
+ respond(r, nil);
                 return;
         }
         f = r->fid->aux;
@@ -691,25 +691,25 @@ fs_write(P9Req *r) {
         case FsFColRules:
         case FsFTagRules:
                 write_to_buf(r, &f->content.rule->string, &f->content.rule->size, 0);
- respond(r, NULL);
+ respond(r, nil);
                 return;
         case FsFKeys:
                 write_to_buf(r, &def.keys, &def.keyssz, 0);
- respond(r, NULL);
+ respond(r, nil);
                 return;
         case FsFCtags:
                 data_to_cstring(r);
                 i=strlen(f->content.client->tags);
                 write_to_buf(r, &f->content.client->tags, &i, 255);
                 r->ofcall.data.rwrite.count = i- r->ifcall.data.twrite.offset;
- respond(r, NULL);
+ respond(r, nil);
                 return;
         case FsFBar:
                 /* XXX: This should validate after each write */
                 i = strlen(f->content.bar->buf);
                 write_to_buf(r, &f->content.bar->buf, &i, 279);
                 r->ofcall.data.rwrite.count = i - r->ifcall.data.twrite.offset;
- respond(r, NULL);
+ respond(r, nil);
                 return;
         case FsFCctl:
                 data_to_cstring(r);
@@ -718,7 +718,7 @@ fs_write(P9Req *r) {
                         return;
                 }
                 r->ofcall.data.rwrite.count = r->ifcall.data.twrite.count;
- respond(r, NULL);
+ respond(r, nil);
                 return;
         case FsFTctl:
                 data_to_cstring(r);
@@ -727,7 +727,7 @@ fs_write(P9Req *r) {
                         return;
                 }
                 r->ofcall.data.rwrite.count = r->ifcall.data.twrite.count;
- respond(r, NULL);
+ respond(r, nil);
                 return;
         case FsFRctl:
                 data_to_cstring(r);
@@ -746,7 +746,7 @@ fs_write(P9Req *r) {
                         return;
                 }
                 r->ofcall.data.rwrite.count = r->ifcall.data.twrite.count;
- respond(r, NULL);
+ respond(r, nil);
                 return;
         case FsFEvent:
                 if(r->ifcall.data.twrite.data[r->ifcall.data.twrite.count-1] == '\n')
@@ -754,7 +754,7 @@ fs_write(P9Req *r) {
                 else
                         write_event("%.*s\n", r->ifcall.data.twrite.count, r->ifcall.data.twrite.data);
                 r->ofcall.data.rwrite.count = r->ifcall.data.twrite.count;
- respond(r, NULL);
+ respond(r, nil);
                 return;
         }
         /* This is an assert because it should this should not be called if
@@ -791,7 +791,7 @@ fs_open(P9Req *r) {
                 respond(r, Enoperm);
                 return;
         }
- respond(r, NULL);
+ respond(r, nil);
 }
 
 void
@@ -818,7 +818,7 @@ fs_create(P9Req *r) {
                 r->ofcall.data.rcreate.qid.path = QID(f->tab.type, f->id);
                 f->next = r->fid->aux;
                 r->fid->aux = f;
- respond(r, NULL);
+ respond(r, nil);
                 break;
         }
 }
@@ -835,7 +835,7 @@ fs_remove(P9Req *r) {
         case FsFBar:
                 destroy_bar(f->next->content.bar_p, f->content.bar);
                 draw_bar(screen);
- respond(r, NULL);
+ respond(r, nil);
                 break;
         }
 }
@@ -887,7 +887,7 @@ fs_clunk(P9Req *r) {
                         }
                 break;
         }
- respond(r, NULL);
+ respond(r, nil);
 }
 
 void
@@ -900,7 +900,7 @@ fs_flush(P9Req *r) {
                         respond(r->oldreq, Einterrupted);
                         break;
                 }
- respond(r, NULL);
+ respond(r, nil);
 }
 
 void
diff -r 6af6ee314a62 -r bd78bc98b117 key.c
--- a/key.c Sun Feb 04 20:57:28 2007 -0500
+++ b/key.c Sun Feb 04 21:02:05 2007 -0500
@@ -156,7 +156,7 @@ emulate_key_press(unsigned long mod, Key
 
 static Key *
 match_keys(Key *k, unsigned long mod, KeyCode keycode, Bool seq) {
- Key *ret = NULL, *next;
+ Key *ret = nil, *next;
 
         for(next = k->tnext; k; (k=next) && (next=k->tnext)) {
                 if(seq)
diff -r 6af6ee314a62 -r bd78bc98b117 main.c
--- a/main.c Sun Feb 04 20:57:28 2007 -0500
+++ b/main.c Sun Feb 04 21:02:05 2007 -0500
@@ -197,7 +197,7 @@ int
 int
 main(int argc, char *argv[]) {
         int i;
- char *address = NULL, *wmiirc = NULL, *namespace, *errstr;
+ char *address = nil, *wmiirc = nil, *namespace, *errstr;
         WMScreen *s;
         struct passwd *passwd;
         XSetWindowAttributes wa;
@@ -264,7 +264,7 @@ main(int argc, char *argv[]) {
         }
         XSetErrorHandler(0);
         x_error_handler = XSetErrorHandler(wmii_error_handler);
- errstr = NULL;
+ errstr = nil;
         i = ixp_create_sock(address, &errstr);
         if(i < 0)
                 ixp_eprint("wmiiwm: fatal: %s\n", errstr);
@@ -281,7 +281,7 @@ main(int argc, char *argv[]) {
                         close(i);
                         close(ConnectionNumber(blz.dpy));
                         snprintf(execstr, name_len, "exec %s", wmiirc);
- execl("/bin/sh", "sh", "-c", execstr, NULL);
+ execl("/bin/sh", "sh", "-c", execstr, nil);
                         ixp_eprint("wmiiwm: can't exec \"%s\": %s\n", wmiirc, strerror(errno));
                 case -1:
                         perror("wmiiwm: cannot fork wmiirc");
@@ -291,19 +291,19 @@ main(int argc, char *argv[]) {
         }
 
         /* IXP server */
- ixp_server_open_conn(&srv, i, &p9srv, serve_9pcon, NULL);
+ ixp_server_open_conn(&srv, i, &p9srv, serve_9pcon, nil);
         /* X server */
- ixp_server_open_conn(&srv, ConnectionNumber(blz.dpy), NULL, check_x_event, NULL);
- view = NULL;
- client = NULL;
- key = NULL;
+ ixp_server_open_conn(&srv, ConnectionNumber(blz.dpy), nil, check_x_event, nil);
+ view = nil;
+ client = nil;
+ key = nil;
         passwd = getpwuid(getuid());
         user = ixp_estrdup(passwd->pw_name);
- def.colrules.string = NULL;
+ def.colrules.string = nil;
         def.colrules.size = 0;
- def.tagrules.string = NULL;
+ def.tagrules.string = nil;
         def.tagrules.size = 0;
- def.keys = NULL;
+ def.keys = nil;
         def.keyssz = 0;
         def.font.fontstr = ixp_estrdup(BLITZ_FONT);
         def.border = 2;
@@ -322,9 +322,9 @@ main(int argc, char *argv[]) {
         screens = ixp_emallocz(num_screens * sizeof(*screens));
         for(i = 0; i < num_screens; i++) {
                 s = &screens[i];
- s->lbar = NULL;
- s->rbar = NULL;
- s->sel = NULL;
+ s->lbar = nil;
+ s->rbar = nil;
+ s->sel = nil;
                 init_screen(s);
                 pmap = XCreatePixmap(blz.dpy, blz.root, s->rect.width, s->rect.height,
                                 DefaultDepth(blz.dpy, blz.screen));
diff -r 6af6ee314a62 -r bd78bc98b117 mouse.c
--- a/mouse.c Sun Feb 04 20:57:28 2007 -0500
+++ b/mouse.c Sun Feb 04 21:02:05 2007 -0500
@@ -105,7 +105,7 @@ snap_rect(XRectangle *rects, int num, XR
 snap_rect(XRectangle *rects, int num, XRectangle *current,
           BlitzAlign *mask, int snap)
 {
- SnapArgs a = { rects, num, 0, 0, 0, 0, *mask, NULL };
+ SnapArgs a = { rects, num, 0, 0, 0, 0, *mask, nil };
         int dx = snap + 1, dy = snap + 1;
         BlitzAlign ret;
 
@@ -171,7 +171,7 @@ do_mouse_resize(Client *c, BlitzAlign al
         Frame *f = c->sel;
         Bool floating = f->area->floating;
         int snap = floating ? screen->rect.height / 66 : 0;
- XRectangle *rects = floating ? rects_of_view(f->area->view, &num) : NULL;
+ XRectangle *rects = floating ? rects_of_view(f->area->view, &num) : nil;
         XRectangle frect = f->rect, ofrect;
         XRectangle origin = frect;
         XPoint pt;
@@ -215,7 +215,7 @@ do_mouse_resize(Client *c, BlitzAlign al
                         pt.x = pt_x;
                         pt.y = pt_y;
                         if(!floating)
- resize_column(c, &frect, (align == CENTER) ? &pt : NULL);
+ resize_column(c, &frect, (align == CENTER) ? &pt : nil);
                         else
                                 resize_client(c, &frect, False);
 
diff -r 6af6ee314a62 -r bd78bc98b117 rule.c
--- a/rule.c Sun Feb 04 20:57:28 2007 -0500
+++ b/rule.c Sun Feb 04 21:02:05 2007 -0500
@@ -34,7 +34,7 @@ update_rules(Rule **rule, const char *da
 update_rules(Rule **rule, const char *data) {
         int mode = IGNORE;
         Rule *rul;
- char *p, *r = NULL, *v = NULL, regex[256], value[256];
+ char *p, *r = nil, *v = nil, regex[256], value[256];
 
         if(!data || !strlen(data))
                 return;
diff -r 6af6ee314a62 -r bd78bc98b117 view.c
--- a/view.c Sun Feb 04 20:57:28 2007 -0500
+++ b/view.c Sun Feb 04 21:02:05 2007 -0500
@@ -39,7 +39,7 @@ assign_sel_view(View *v) {
 
 Client *
 sel_client_of_view(View *v) {
- return v->sel && v->sel->sel ? v->sel->sel->client : NULL;
+ return v->sel && v->sel->sel ? v->sel->sel->client : nil;
 }
 
 View *
@@ -62,7 +62,7 @@ create_view(const char *name) {
 
         v->id = id++;
         strncpy(v->name, name, sizeof(v->name));
- create_area(v, NULL, 0);
+ create_area(v, nil, 0);
         create_area(v, v->area, 0);
         v->area->floating = True;
         for(i=&view; *i; i=&(*i)->next)
@@ -150,7 +150,7 @@ attach_to_view(View *v, Frame *f) {
         Client *c = f->client;
         unsigned int i;
 
- c->revert = NULL;
+ c->revert = nil;
         a = v->sel;
         if(c->trans || c->floating || c->fixedsize
                 || (c->rect.width == screen->rect.width && c->rect.height == screen->rect.height))
@@ -171,7 +171,7 @@ restack_view(View *v) {
         Frame *f;
         Client *c;
         unsigned int n, i;
- static Window *wins = NULL;
+ static Window *wins = nil;
         static unsigned int winssz = 0;
 
         i = 0;
@@ -326,7 +326,7 @@ client_of_message(View *v, char *message
         if(!id)
                 sscanf(message, "%lu %n", &id, next);
         if(!id)
- return NULL;
+ return nil;
     for(c=client; c && c->win!=id; c=c->next);
         return c;
 }
@@ -343,7 +343,7 @@ area_of_message(View *v, char *message,
         if(!strncmp(message, "~ ", 2))
                 return v->area;
         if(1 != sscanf(message, "%d %n", &i, next) || i == 0)
- return NULL;
+ return nil;
         for(a=v->area; i && a; a=a->next, i--);
         return a;
 }
@@ -380,7 +380,7 @@ message_view(View *v, char *message) {
                 if(v == screen->sel)
                         focus_view(screen, v);
                 draw_frames();
- return NULL;
+ return nil;
         }
         return Ebadvalue;
 }
@@ -392,8 +392,8 @@ update_views() {
 
         for(v=view; v; v=v->next)
                 update_frame_selectors(v);
- if(old && !strncmp(old->name, "NULL", 4))
- old = NULL;
+ if(old && !strncmp(old->name, "nil", 4))
+ old = nil;
         for((v=view) && (n=v->next); v; (v=n) && (n=v->next))
                 if((v != old) && is_empty(v))
                         destroy_view(v);
diff -r 6af6ee314a62 -r bd78bc98b117 wmii.h
--- a/wmii.h Sun Feb 04 20:57:28 2007 -0500
+++ b/wmii.h Sun Feb 04 21:02:05 2007 -0500
@@ -9,6 +9,8 @@
 #include <X11/Xutil.h>
 
 #include <ixp.h>
+
+#define nil ((void*)0)
 
 #define BLITZ_FONT "-*-fixed-medium-r-normal-*-13-*-*-*-*-*-*-*"
 #define BLITZ_FOCUSCOLORS "#ffffff #335577 #447799"
Received on Mon Feb 05 2007 - 03:10:04 UTC

This archive was generated by hypermail 2.2.0 : Sun Jul 13 2008 - 15:54:53 UTC