<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
I am resending this e-mail to the list, I didn't notice I was replying to Uli directly, apologies.</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
===========================================================</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
The function is supposed to return the pointer to the current element in that iterator, I have found no function that does that in libxcb. Consider the program below:
<div><br>
</div>
<div>#include <stdio.h></div>
<div>#include <stdlib.h></div>
<div><br>
</div>
<div>#include <xcb/xcb.h></div>
<div><br>
</div>
<div>int main(void)</div>
<div>{</div>
<div>    xcb_connection_t *connection = xcb_connect(NULL, NULL);</div>
<div>    xcb_list_extensions_cookie_t cookie = xcb_list_extensions(connection);</div>
<div>    const xcb_list_extensions_reply_t *reply = xcb_list_extensions_reply(connection, cookie, 0);</div>
<div>    xcb_str_iterator_t str_iterator = xcb_list_extensions_names_iterator(reply);</div>
<div><br>
</div>
<div>    while(str_iterator.rem) { // verify if there are any elements left</div>
<div>        xcb_str_t *name = str_iterator.data; // gather the current element in the iterator</div>
<div>        int length = xcb_str_name_length(name);</div>
<div>        char *str = xcb_str_name(name);</div>
<div>        fwrite(str, sizeof(*str), length, stdout);</div>
<div>        putchar('\n');</div>
<div>        xcb_str_next(&str_iterator);</div>
<div>    }</div>
<div>    xcb_disconnect(connection);</div>
<div>    exit(EXIT_SUCCESS);</div>
<div>}</div>
<div><br>
</div>
<div>I don't know how useful this program is outside of an educational purpose, but notice that the members rem and data from the iterator has to be accessed by the user in order to finally convert it to a stringm then send that to stdout. If the members rem
 and data aren't supposed to be accessed by the user, I suggest creating a function to access them, or modify xcb_str_next to return a pointer to xcb_str_t for the current element, then have it iterate to the next element.</div>
If the members of the struct xcb_str_iterator_t are supposed to be accessed by the user, then there is no reason to add said function.<br>
</div>
<div id="appendonsend"></div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>De:</b> Xcb <xcb-bounces@lists.freedesktop.org> em nome de Uli Schlachter <psychon@znc.in><br>
<b>Enviado:</b> domingo, 7 de março de 2021 05:35<br>
<b>Para:</b> Lucas <lucasvalentim@outlook.com.br>; xcb@lists.freedesktop.org <xcb@lists.freedesktop.org><br>
<b>Assunto:</b> Re: [Xcb] Are there any naming conventions for XCB?</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText">Hi,<br>
<br>
Am 14.02.21 um 23:37 schrieb Lucas:<br>
> I want to introduce one function (another one might be needed) to return<br>
> a xcb_str_t pointer from an iterator because I could not find a function<br>
> to do just that, but I have noticed a pattern in the names of the<br>
> function, hence the question. Here is the function:<br>
> <br>
> xcb_str_t *xcb_str_iterator_name(xcb_str_iterator_t *iterator)<br>
> {<br>
>     return iterator->data;<br>
> }<br>
<br>
Uhm, sorry, but *why*? Can't you just put this function into your own<br>
code with a name of your liking? Why do you think this needs to be in<br>
libxcb?<br>
<br>
Also, are you sure the function above really does what you want it to<br>
do? Aren't you instead looking for the already existing xcb_str_name()?<br>
<br>
And for the question about naming conventions: Well... kind of. Since<br>
most of the code is automatically generated from an XML description, I<br>
guess "what the code generator does" is the naming convention. It all<br>
maps pretty mechanical to the XML, I think.<br>
<br>
Cheers,<br>
Uli<br>
-- <br>
This can be a, a little complicated. Listen, my advice is... ask<br>
somebody else for advice, at least someone who's... got more experience<br>
at...  giving advice.<br>
_______________________________________________<br>
Xcb mailing list<br>
Xcb@lists.freedesktop.org<br>
<a href="https://lists.freedesktop.org/mailman/listinfo/xcb">https://lists.freedesktop.org/mailman/listinfo/xcb</a><br>
</div>
</span></font></div>
</body>
</html>