From ed62570d2eacaa2f7a31df0db13bc1194916df63 Mon Sep 17 00:00:00 2001 From: frese Date: Sun, 4 May 2003 15:19:39 +0000 Subject: [PATCH] fixed declaration/code mixing --- c/xlib/client.c | 2 +- c/xlib/colormap.c | 9 ++++++--- c/xlib/event.c | 5 +++-- c/xlib/gcontext.c | 7 ++++--- c/xlib/grab.c | 3 ++- c/xlib/key.c | 3 ++- c/xlib/pixmap.c | 11 ++++++----- c/xlib/text.c | 3 ++- 8 files changed, 26 insertions(+), 17 deletions(-) diff --git a/c/xlib/client.c b/c/xlib/client.c index b4be335..f934cfd 100644 --- a/c/xlib/client.c +++ b/c/xlib/client.c @@ -241,8 +241,8 @@ s48_value scx_Get_Wm_Hints(s48_value dpy, s48_value w) { s48_value scx_Set_Wm_Hints (s48_value dpy, s48_value w, s48_value hints) { XWMHints WMH; - scx_extract_wm_hint_alist(hints, &WMH); S48_DECLARE_GC_PROTECT_3(dpy, w, hints); + scx_extract_wm_hint_alist(hints, &WMH); XSetWMHints(scx_extract_display(dpy), scx_extract_window(w), diff --git a/c/xlib/colormap.c b/c/xlib/colormap.c index 408d7a2..f8d9b11 100644 --- a/c/xlib/colormap.c +++ b/c/xlib/colormap.c @@ -51,8 +51,9 @@ s48_value scx_enter_color(const XColor* c) { s48_value scx_Create_Colormap (s48_value display, s48_value window, s48_value visual, s48_value alloc) { + Colormap cm; S48_DECLARE_GC_PROTECT_4(display, window, visual, alloc); - Colormap cm = XCreateColormap(scx_extract_display(display), + cm = XCreateColormap(scx_extract_display(display), scx_extract_window(window), scx_extract_visual(visual), scx_extract_colormap_alloc(alloc)); @@ -60,8 +61,9 @@ s48_value scx_Create_Colormap (s48_value display, s48_value window, } s48_value scx_Copy_Colormap_And_Free(s48_value display, s48_value colormap) { + Colormap cm; S48_DECLARE_GC_PROTECT_2(display, colormap); - Colormap cm = XCopyColormapAndFree(scx_extract_display(display), + cm = XCopyColormapAndFree(scx_extract_display(display), scx_extract_colormap(colormap)); S48_GC_RETURN(scx_enter_colormap(cm)); } @@ -206,8 +208,9 @@ s48_value scx_Lookup_Color(s48_value display, s48_value colormap, s48_value color_name) { XColor cexact, cscreen; s48_value r = S48_NULL; + int res; S48_DECLARE_GC_PROTECT_4(display, colormap, color_name, r); - int res = XLookupColor(scx_extract_display(display), + res = XLookupColor(scx_extract_display(display), scx_extract_colormap(colormap), s48_extract_string(color_name), &cexact, &cscreen); diff --git a/c/xlib/event.c b/c/xlib/event.c index d9a5aad..1705b1d 100644 --- a/c/xlib/event.c +++ b/c/xlib/event.c @@ -6,9 +6,10 @@ s48_value scx_queued_mode_binding = S48_FALSE; #define scx_extract_queued_mode(x) S48_EXTRACT_ENUM(x, scx_queued_mode_binding) s48_value scx_Events_Queued(s48_value display, s48_value mode) { + int r; S48_DECLARE_GC_PROTECT_2(display, mode); - int r = XEventsQueued(scx_extract_display(display), - scx_extract_queued_mode(mode)); + r = XEventsQueued(scx_extract_display(display), + scx_extract_queued_mode(mode)); S48_GC_RETURN(s48_enter_integer(r)); } diff --git a/c/xlib/gcontext.c b/c/xlib/gcontext.c index e79d9fb..eb347f0 100644 --- a/c/xlib/gcontext.c +++ b/c/xlib/gcontext.c @@ -242,11 +242,12 @@ s48_value scx_Create_Gc(s48_value display, s48_value drawable, s48_value values) { XGCValues GCV; unsigned long mask; + GC gc; S48_DECLARE_GC_PROTECT_3(display, drawable, values); mask = scx_extract_gc_value_alist(values, &GCV); - GC gc = XCreateGC(scx_extract_display(display), - scx_extract_drawable(drawable), - mask, &GCV); + gc = XCreateGC(scx_extract_display(display), + scx_extract_drawable(drawable), + mask, &GCV); S48_GC_RETURN(scx_enter_gc(gc)); } diff --git a/c/xlib/grab.c b/c/xlib/grab.c index 526d2d8..a546e0b 100644 --- a/c/xlib/grab.c +++ b/c/xlib/grab.c @@ -75,8 +75,9 @@ s48_value scx_Ungrab_Button(s48_value dpy, s48_value button, s48_value scx_Grab_Keyboard(s48_value dpy, s48_value win, s48_value ownerp, s48_value pmode, s48_value kmode, s48_value time) { + int res; S48_DECLARE_GC_PROTECT_6(dpy, win, ownerp, pmode, kmode, time); - int res = XGrabKeyboard( scx_extract_display(dpy), + res = XGrabKeyboard( scx_extract_display(dpy), scx_extract_window(win), S48_EXTRACT_BOOLEAN(ownerp), scx_extract_grab_mode(pmode), diff --git a/c/xlib/key.c b/c/xlib/key.c index 454edae..845c3a3 100644 --- a/c/xlib/key.c +++ b/c/xlib/key.c @@ -86,8 +86,9 @@ s48_value scx_Set_Modifier_Mapping(s48_value display, s48_value modmap) { for (l = modmap; l != S48_NULL; l = S48_CDR(l)) { int mod = scx_extract_state(S48_CAR(S48_CAR(l))); + int j; l2 = S48_CDR(S48_CAR(l)); - int j = 0; + j = 0; for (j = 0; j < max; j++) { if ((mod < 0) || (mod > 7)) continue; /* TODO: error?? */ if (l2 != S48_NULL) { diff --git a/c/xlib/pixmap.c b/c/xlib/pixmap.c index 14183ee..4728fe4 100644 --- a/c/xlib/pixmap.c +++ b/c/xlib/pixmap.c @@ -4,12 +4,13 @@ s48_value scx_Create_Pixmap(s48_value display, s48_value drawable, s48_value w, s48_value h, s48_value depth) { + Pixmap pm; S48_DECLARE_GC_PROTECT_5(display, drawable, w, h, depth); - Pixmap pm = XCreatePixmap(scx_extract_display(display), - scx_extract_drawable(drawable), - (int)s48_extract_integer(w), - (int)s48_extract_integer(h), - (int)s48_extract_integer(depth)); + pm = XCreatePixmap(scx_extract_display(display), + scx_extract_drawable(drawable), + (int)s48_extract_integer(w), + (int)s48_extract_integer(h), + (int)s48_extract_integer(depth)); S48_GC_RETURN(scx_enter_pixmap(pm)); } diff --git a/c/xlib/text.c b/c/xlib/text.c index d3c794a..e50cbe4 100644 --- a/c/xlib/text.c +++ b/c/xlib/text.c @@ -62,9 +62,10 @@ void scx_extract_text_item_16(s48_value v, XTextItem16* ti) { { if (S48_RECORD_REF(v, 0) != S48_FALSE) { int i, n; + XChar2b* s; l = S48_RECORD_REF(v, 0); n = s48_list_length(l); - XChar2b* s = (XChar2b*)malloc(n * sizeof(XChar2b)); + s = (XChar2b*)malloc(n * sizeof(XChar2b)); for (i = n-1; i >= 0; i--) { ti->chars[i].byte1 = s48_extract_integer(S48_CAR(S48_CAR(l))); ti->chars[i].byte2 = s48_extract_integer(S48_CDR(S48_CAR(l)));