keep the atom init cookie list in a local variables, rather than in global variables. memory usage--

SVN revision: 29910
This commit is contained in:
tilman 2007-05-07 18:21:53 +00:00 committed by tilman
parent ee0000f75f
commit d5c7189898
3 changed files with 13 additions and 13 deletions

View File

@ -182,6 +182,8 @@ ecore_x_init(const char *name)
const xcb_query_extension_reply_t *reply_xprint;
#endif /* ECORE_XCB_XPRINT */
xcb_intern_atom_cookie_t atom_cookies[ECORE_X_ATOMS_COUNT];
if (_ecore_xcb_init_count > 0)
{
_ecore_xcb_init_count++;
@ -205,8 +207,9 @@ ecore_x_init(const char *name)
*
*/
/* We request the atoms (non blocking) */
_ecore_x_atom_init();
_ecore_x_atom_init(atom_cookies);
/* We prefetch all the extension data (non blocking) */
@ -277,7 +280,7 @@ ecore_x_init(const char *name)
*/
/* We get the atoms (blocking) */
_ecore_x_atom_init_finalize();
_ecore_x_atom_init_finalize(atom_cookies);
/* We then ask for the extension data (blocking) */
reply_big_requests = xcb_get_extension_data(_ecore_xcb_conn, &xcb_big_requests_id);

View File

@ -11,10 +11,6 @@
* Functions that operate on atoms.
*/
#define ECORE_X_ATOMS_COUNT 115
static xcb_intern_atom_cookie_t ecore_xcb_atom_init_cookies[ECORE_X_ATOMS_COUNT];
/*********/
/* Atoms */
/*********/
@ -230,12 +226,11 @@ EAPI Ecore_X_Atom ECORE_X_ATOM_SELECTION_PROP_CLIPBOARD = 0;
the second one gets the replies and set the atoms. */
#define FETCH_ATOM(s) \
ecore_xcb_atom_init_cookies[i] = \
xcb_intern_atom(_ecore_xcb_conn, 0, sizeof(s), s); \
atom_cookies[i] = xcb_intern_atom(_ecore_xcb_conn, 0, sizeof(s), s); \
i++
void
_ecore_x_atom_init(void)
_ecore_x_atom_init(xcb_intern_atom_cookie_t *atom_cookies)
{
int i = 0;
@ -411,7 +406,7 @@ _ecore_x_atom_init(void)
}
void
_ecore_x_atom_init_finalize(void)
_ecore_x_atom_init_finalize(xcb_intern_atom_cookie_t *atom_cookies)
{
xcb_intern_atom_reply_t *replies[ECORE_X_ATOMS_COUNT];
int i;
@ -420,7 +415,7 @@ _ecore_x_atom_init_finalize(void)
xcb_generic_error_t *error = NULL;
replies[i] = xcb_intern_atom_reply(_ecore_xcb_conn,
ecore_xcb_atom_init_cookies[i],
atom_cookies[i],
&error);
if (!replies[i]) {
printf ("pas de reply %d\n", i);

View File

@ -227,8 +227,10 @@ extern Ecore_X_Atom ECORE_X_ATOM_WINDOW;
extern Ecore_X_Atom ECORE_X_ATOM_E_FRAME_SIZE;
extern Ecore_X_Atom ECORE_X_ATOM_WM_SIZE_HINTS;
void _ecore_x_atom_init (void);
void _ecore_x_atom_init_finalize (void);
#define ECORE_X_ATOMS_COUNT 115
void _ecore_x_atom_init (xcb_intern_atom_cookie_t *);
void _ecore_x_atom_init_finalize (xcb_intern_atom_cookie_t *);
/* damage */