stanza: return const char* for non allocated strings
If interface function returns char* the result must be freed with xmpp_free(). In case of const char* the result must not be changed by user. Also, the result is valid only during stanza lifetime.
This commit is contained in:
@@ -24,7 +24,7 @@ int handle_reply(xmpp_conn_t * const conn,
|
||||
void * const userdata)
|
||||
{
|
||||
xmpp_stanza_t *query, *item;
|
||||
char *type;
|
||||
const char *type;
|
||||
|
||||
type = xmpp_stanza_get_type(stanza);
|
||||
if (strcmp(type, "error") == 0)
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
int version_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, void * const userdata)
|
||||
{
|
||||
xmpp_stanza_t *reply, *query, *name, *version, *text;
|
||||
char *ns;
|
||||
const char *ns;
|
||||
xmpp_ctx_t *ctx = (xmpp_ctx_t*)userdata;
|
||||
printf("Received version request from %s\n", xmpp_stanza_get_from(stanza));
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ int handle_reply(xmpp_conn_t * const conn,
|
||||
void * const userdata)
|
||||
{
|
||||
xmpp_stanza_t *query, *item;
|
||||
char *type, *name;
|
||||
const char *type, *name;
|
||||
|
||||
type = xmpp_stanza_get_type(stanza);
|
||||
if (strcmp(type, "error") == 0)
|
||||
|
||||
Reference in New Issue
Block a user