use more safe functions and update #inlcude

This commit is contained in:
Julien Danjou 2007-09-11 14:00:49 +02:00
parent 7064e17726
commit 9f56ade4e9
11 changed files with 6 additions and 25 deletions

View File

@ -3,7 +3,6 @@
#include <errno.h>
#include <locale.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/select.h>
#include <X11/cursorfont.h>
@ -13,7 +12,6 @@
#include <X11/Xutil.h>
#include "awesome.h"
#include "util.h"
#include "event.h"
#include "layout.h"
#include "tag.h"
@ -345,7 +343,7 @@ main(int argc, char *argv[])
readin = False;
break;
default:
for(awesomeconf.statustext[r] = '\0', p = awesomeconf.statustext + strlen(awesomeconf.statustext) - 1;
for(awesomeconf.statustext[r] = '\0', p = awesomeconf.statustext + a_strlen(awesomeconf.statustext) - 1;
p >= awesomeconf.statustext && *p == '\n'; *p-- = '\0');
for(; p >= awesomeconf.statustext && *p != '\n'; --p);
if(p > awesomeconf.statustext)

View File

@ -1,12 +1,10 @@
/* See LICENSE file for copyright and license details. */
#include <stdlib.h>
#include <stdio.h>
#include <X11/Xatom.h>
#include <X11/Xutil.h>
#include "awesome.h"
#include "util.h"
#include "layout.h"
#include "tag.h"

View File

@ -4,12 +4,10 @@
* \defgroup ui_callback
*/
#include <stdlib.h>
#include <libconfig.h>
#include <X11/keysym.h>
#include "awesome.h"
#include "util.h"
#include "layout.h"
#include "tag.h"
#include "layouts/tile.h"

2
draw.c
View File

@ -20,7 +20,7 @@ drawtext(Display *disp, const char *text, unsigned long col[ColLast])
if(!text)
return;
w = 0;
olen = len = strlen(text);
olen = len = a_strlen(text);
if(len >= sizeof buf)
len = sizeof buf - 1;
memcpy(buf, text, len);

5
draw.h
View File

@ -3,10 +3,9 @@
#ifndef AWESOME_DRAW_H
#define AWESOME_DRAW_H
#include <string.h>
#include "config.h"
#include "util.h"
#define textw(text) (textnw(text, strlen(text)) + dc.font.height)
#define textw(text) (textnw(text, a_strlen(text)) + dc.font.height)
void drawstatus(Display *, awesome_config *); /* draw the bar */
unsigned int textnw(const char *, unsigned int);

View File

@ -1,11 +1,9 @@
/* See LICENSE file for copyright and license details. */
#include <stdlib.h>
#include <X11/keysym.h>
#include <X11/Xatom.h>
#include <X11/Xutil.h>
#include "awesome.h"
#include "util.h"
#include "event.h"
#include "layout.h"
#include "tag.h"

View File

@ -1,6 +1,5 @@
/* See LICENSE file for copyright and license details. */
#include <stdlib.h>
#include <X11/Xatom.h>
#include <X11/Xutil.h>
@ -8,7 +7,6 @@
#include "layout.h"
#include "tag.h"
#include "layouts/floating.h"
#include "util.h"
/* extern */
extern int wax, way, wah, waw; /* windowarea geometry */

View File

@ -1,7 +1,6 @@
/* See LICENSE file for copyright and license details. */
#include <stdio.h>
#include <stdlib.h>
#include "layouts/tile.h"
#include "layout.h"

8
tag.c
View File

@ -1,10 +1,8 @@
/* See LICENSE file for copyright and license details. */
#include <stdio.h>
#include <stdlib.h>
#include <X11/Xutil.h>
#include "util.h"
#include "layout.h"
#include "tag.h"
@ -41,11 +39,7 @@ applyrules(Client * c, awesome_config *awesomeconf)
XClassHint ch = { 0, 0 };
char *prop;
if(ch.res_class)
len += strlen(ch.res_class);
if(ch.res_name)
len += strlen(ch.res_name);
len += strlen(c->name);
len += a_strlen(ch.res_class) + a_strlen(ch.res_name) + a_strlen(c->name);
prop = p_new(char, len + 1);

2
util.c
View File

@ -2,10 +2,8 @@
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/wait.h>
#include <unistd.h>
#include <string.h>
#include "util.h"

1
util.h
View File

@ -4,6 +4,7 @@
#define AWESOME_MEM_H
#include <string.h>
#include <stdlib.h>
#include "config.h"
#define ssizeof(foo) (ssize_t)sizeof(foo)