[Xcb] [Xcb-commit] tutorial.mdwn

Vincent Torri vtorri at univ-evry.fr
Sun Nov 11 03:17:56 PST 2007



> @@ -125,20 +125,19 @@ Here is a program that computes the time to create 500 atoms with Xlib and XCB.
> 		{
> 			xcb_connection_t          *connection = xcb_connect (NULL, NULL);
> 			xcb_atom_t                atoms[NUM_NAMES];
> -			xcb_intern_atom_cookie_t  cookies[NUM_NAMES];
>
> 			// in this bad use of xcb, we use the cookie immediately after posting the request with xcb_intern_atom
>
> 			for (int i = 0; i < NUM_NAMES; ++i) {
> 				/* make request */
> -				cookies[i] = xcb_intern_atom (connection,
> -											  0,
> -											  strlen(names[i]),
> -											  names[i] );
> +				xcb_intern_atom_cookie_t cookie = xcb_intern_atom (connection,
> +																   0,
> +																   strlen(names[i]),
> +																   names[i] );
>
> 				/* get response */
> 				xcb_intern_atom_reply_t *reply = xcb_intern_atom_reply (connection,
> -																		cookies[i],
> +																		cookie,
> 																		NULL ); // normally a pointer to receive error, but we'll just ignore error handling
>
> 				if (reply) {
> @@ -146,6 +145,8 @@ Here is a program that computes the time to create 500 atoms with Xlib and XCB.
> 				}
> 				free(reply);
> 			}
> +
> +			// now we have our atoms (replies), but this is just a demo, so we do nothing with them
>
> 			xcb_disconnect (connection);
> 		}
> @@ -180,6 +181,8 @@ Here is a program that computes the time to create 500 atoms with Xlib and XCB.
> 				}
> 				free (reply);
> 			}
> +
> +			// now we have our atoms (replies), but this is just a demo, so we do nothing with them
>
> 			xcb_disconnect (connection);

why did you change that code, please ?

Vincent


More information about the Xcb mailing list