[PATCH 5/6] Remove useless xcb_atom_get_fast*() and xcb_atom_get_name().

Arnaud Fontaine arnau at debian.org
Sat Sep 4 09:27:52 PDT 2010


These functions and their types would require to write their unchecked
equivalent however it's not worth the effort when considering that
they only hide InternAtom request/reply and nothing else.
---
 atom/atoms.gperf.m4 |   65 ---------------------------------------------------
 atom/xcb_atom.h.m4  |   16 ------------
 2 files changed, 0 insertions(+), 81 deletions(-)

diff --git a/atom/atoms.gperf.m4 b/atom/atoms.gperf.m4
index ea006df..8876e26 100644
--- a/atom/atoms.gperf.m4
+++ b/atom/atoms.gperf.m4
@@ -48,44 +48,6 @@ xcb_atom_t xcb_atom_get_predefined(uint16_t name_len, const char *name)
 	return ret;
 }
 
-xcb_atom_fast_cookie_t xcb_atom_get_fast(xcb_connection_t *c, uint8_t only_if_exists, uint16_t name_len, const char *name)
-{
-	xcb_atom_fast_cookie_t cookie;
-
-	if((cookie.u.atom = xcb_atom_get_predefined(name_len, name)) != XCB_NONE)
-	{
-		cookie.tag = TAG_VALUE;
-		return cookie;
-	}
-
-	cookie.tag = TAG_COOKIE;
-	cookie.u.cookie = xcb_intern_atom(c, only_if_exists, name_len, name);
-	return cookie;
-}
-
-xcb_atom_t xcb_atom_get_fast_reply(xcb_connection_t *c, xcb_atom_fast_cookie_t cookie, xcb_generic_error_t **e)
-{
-	switch(cookie.tag)
-	{
-		xcb_intern_atom_reply_t *reply;
-	case TAG_VALUE:
-		if(e)
-			*e = 0;
-		break;
-	case TAG_COOKIE:
-		reply = xcb_intern_atom_reply(c, cookie.u.cookie, e);
-		if(reply)
-		{
-			cookie.u.atom = reply->atom;
-			free(reply);
-		}
-		else
-			cookie.u.atom = XCB_NONE;
-		break;
-	}
-	return cookie.u.atom;
-}
-
 const char *xcb_atom_get_name_predefined(xcb_atom_t atom)
 {
 	if(atom <= 0 || atom > (sizeof(atom_name_offsets) / sizeof(*atom_name_offsets)))
@@ -93,33 +55,6 @@ const char *xcb_atom_get_name_predefined(xcb_atom_t atom)
 	return atom_names + atom_name_offsets[atom - 1];
 }
 
-int xcb_atom_get_name(xcb_connection_t *c, xcb_atom_t atom, const char **namep, int *lengthp)
-{
-	static char buf[100];
-	const char *name = xcb_atom_get_name_predefined(atom);
-	int namelen;
-	xcb_get_atom_name_cookie_t atomc;
-	xcb_get_atom_name_reply_t *atomr;
-	if(name)
-	{
-		*namep = name;
-		*lengthp = strlen(name);
-		return 1;
-	}
-	atomc = xcb_get_atom_name(c, atom);
-	atomr = xcb_get_atom_name_reply(c, atomc, 0);
-	if(!atomr)
-		return 0;
-	namelen = xcb_get_atom_name_name_length(atomr);
-	if(namelen > sizeof(buf))
-		namelen = sizeof(buf);
-	*lengthp = namelen;
-	memcpy(buf, xcb_get_atom_name_name(atomr), namelen);
-	*namep = buf;
-	free(atomr);
-	return 1;
-}
-
 static char *makename(const char *fmt, ...)
 {
 	char *ret;
diff --git a/atom/xcb_atom.h.m4 b/atom/xcb_atom.h.m4
index fe80bc0..27449bd 100644
--- a/atom/xcb_atom.h.m4
+++ b/atom/xcb_atom.h.m4
@@ -7,24 +7,8 @@
 extern "C" {
 #endif
 
-enum xcb_atom_fast_tag_t {
-	TAG_COOKIE,
-	TAG_VALUE
-};
-typedef struct {
-	enum xcb_atom_fast_tag_t tag;
-	union {
-		xcb_intern_atom_cookie_t cookie;
-		xcb_atom_t atom;
-	} u;
-} xcb_atom_fast_cookie_t;
-
 xcb_atom_t xcb_atom_get_predefined(uint16_t name_len, const char *name);
-xcb_atom_fast_cookie_t xcb_atom_get_fast(xcb_connection_t *c, uint8_t only_if_exists, uint16_t name_len, const char *name);
-xcb_atom_t xcb_atom_get_fast_reply(xcb_connection_t *c, xcb_atom_fast_cookie_t cookie, xcb_generic_error_t **e);
-
 const char *xcb_atom_get_name_predefined(xcb_atom_t atom);
-int xcb_atom_get_name(xcb_connection_t *c, xcb_atom_t atom, const char **namep, int *lengthp);
 
 char *xcb_atom_name_by_screen(const char *base, uint8_t screen);
 char *xcb_atom_name_by_resource(const char *base, uint32_t resource);
-- 
1.7.2.3


--=-=-=
Content-Type: text/x-diff
Content-Disposition: attachment;
 filename=0006-Bump-version-to-0.3.8-and-SONAME.patch



More information about the Xcb mailing list