matthieu-labas/sxmlc

A few suggestions

Closed this issue · 1 comments

Hello Matthieu. While trying to use sxmlc on Linux, I found these 3 little things:

  • In
    int XML_parse_attribute_to(const SXML_CHAR* str, int to, XMLAttribute* xmlattr)
    maybe change
    SXML_CHAR quote;
    to
    SXML_CHAR quote='\0'
    (variable used without initialisation)

  • Maybe rename
    #define sx_strdup __strdup
    to
    #define sx_strdup __sx_strdup
    because it is already defined in /usr/include/bits/string2.h

  • Variable ch could be used without being initialised in read_line_alloc(). Maybe set it to EOF here:
    if ((c = mgetc(in)) == EOF) { ch = EOF; break;

Thank you for your suggestions. I have implemented them to ease compilation warnings. I don't have string2.h on my system but I guess it's better practise, as strdup sounds like it could be re-used in some other libraries...
I have pushed v2.4.5 with the changes.