X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=modules%2Fcodec%2Fcmml%2Fxtag.c;h=812e280a264e5fe3a9a2b725fd80a512222d49a9;hb=5cb4066e102b6c6e89ab890439c5bf9c74703262;hp=e70dfe7899251c9d6fba8153e9386f059dd83e38;hpb=2cb472dba008f7d877ffe6bae9c5575253365282;p=vlc diff --git a/modules/codec/cmml/xtag.c b/modules/codec/cmml/xtag.c index e70dfe7899..812e280a26 100644 --- a/modules/codec/cmml/xtag.c +++ b/modules/codec/cmml/xtag.c @@ -24,14 +24,15 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. *****************************************************************************/ - -#include "config.h" +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif #include -#include #include #include #include +#include #include @@ -80,6 +81,15 @@ struct _XTagParser { char * end; }; +XTag * xtag_free (XTag * xtag); +XTag * xtag_new_parse (const char * s, int n); +char * xtag_get_name (XTag * xtag); +char * xtag_get_pcdata (XTag * xtag); +char * xtag_get_attribute (XTag * xtag, char * attribute); +XTag * xtag_first_child (XTag * xtag, char * name); +XTag * xtag_next_child (XTag * xtag, char * name); +int xtag_snprint (char * buf, int n, XTag * xtag); + /* Character classes */ #define X_NONE 0 #define X_WHITESPACE 1<<0 @@ -176,7 +186,7 @@ xtag_skip_to (XTagParser * parser, int char_class) } } - return; + return; } #endif @@ -411,14 +421,14 @@ xtag_free (XTag * xtag) if (xtag == NULL) return NULL; - if (xtag->name) free (xtag->name); - if (xtag->pcdata) free (xtag->pcdata); + free( xtag->name ); + free( xtag->pcdata ); for (l = xtag->attributes; l; l = l->next) { if ((attr = (XAttribute *)l->data) != NULL) { - if (attr->name) free (attr->name); - if (attr->value) free (attr->value); - free (attr); + free( attr->name ); + free( attr->value ); + free( attr ); } } xlist_free (xtag->attributes); @@ -609,7 +619,7 @@ xtag_snprints (char * buf, int n, ...) int len, to_copy, total = 0; va_start (ap, n); - + for (s = va_arg (ap, char *); s; s = va_arg (ap, char *)) { len = strlen (s); @@ -658,19 +668,19 @@ xtag_snprint (char * buf, int n, XTag * xtag) for (l = xtag->attributes; l; l = l->next) { attr = (XAttribute *)l->data; - + nn = xtag_snprints (buf, n, " ", attr->name, "=\"", attr->value, "\"", NULL); FORWARD(nn); } - + if (xtag->children == NULL) { nn = xtag_snprints (buf, n, "/>", NULL); FORWARD(nn); return written; } - + nn = xtag_snprints (buf, n, ">", NULL); FORWARD(nn); }