From 79c9fbe243542d9e5bdb098465a90282ffceb69c Mon Sep 17 00:00:00 2001 From: Dana Jansens Date: Sun, 2 Mar 2008 23:09:13 -0500 Subject: [PATCH] no globals --- dcompmgr.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/dcompmgr.c b/dcompmgr.c index 9008a16..12a711b 100644 --- a/dcompmgr.c +++ b/dcompmgr.c @@ -6,10 +6,8 @@ #include #include -static d_screen_t *screens = NULL; - static gint -all_screens(xcb_connection_t *conn) +all_screens(xcb_connection_t *conn, d_screen_t **list) { static const xcb_setup_t *setup; xcb_screen_iterator_t it; @@ -24,8 +22,8 @@ all_screens(xcb_connection_t *conn) sc.num = i++; if (screen_register(conn, &sc)) { ++count; - screens = g_renew(d_screen_t, screens, count); - screens[count-1] = sc; + *list = g_renew(d_screen_t, *list, count); + (*list)[count-1] = sc; printf(_("managing screen %d\n"), sc.num); } } @@ -36,6 +34,7 @@ int main(int argc, char **argv) { xcb_connection_t *conn; + d_screen_t *screens = NULL; conn = xcb_connect(NULL, NULL); if (!conn) { @@ -43,7 +42,7 @@ main(int argc, char **argv) return 1; } - all_screens(conn); + all_screens(conn, &screens); xcb_disconnect(conn); -- 2.34.1