mirror of
https://github.com/libretro/RetroArch
synced 2025-03-29 04:20:28 +00:00
(yxml) Remove unused inline function; get rid of inline macro
This commit is contained in:
parent
d3fd72ba63
commit
aea4b3e318
61
deps/yxml/yxml.c
vendored
61
deps/yxml/yxml.c
vendored
@ -22,9 +22,11 @@
|
||||
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "yxml.h"
|
||||
#include <retro_INLINE.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "yxml.h"
|
||||
|
||||
typedef enum {
|
||||
YXMLS_string,
|
||||
YXMLS_attr0,
|
||||
@ -119,7 +121,7 @@ typedef enum {
|
||||
* unsigned-to-signed overflow is implementation defined in C. This function
|
||||
* /looks/ inefficient, but gcc compiles it down to a single movb instruction
|
||||
* on x86, even with -O0. */
|
||||
static inline void yxml_setchar(char *dest, unsigned ch) {
|
||||
static INLINE void yxml_setchar(char *dest, unsigned ch) {
|
||||
unsigned char _ch = ch;
|
||||
memcpy(dest, &_ch, 1);
|
||||
}
|
||||
@ -147,21 +149,21 @@ static void yxml_setutf8(char *dest, unsigned ch) {
|
||||
}
|
||||
|
||||
|
||||
static inline yxml_ret_t yxml_datacontent(yxml_t *x, unsigned ch) {
|
||||
static INLINE yxml_ret_t yxml_datacontent(yxml_t *x, unsigned ch) {
|
||||
yxml_setchar(x->data, ch);
|
||||
x->data[1] = 0;
|
||||
return YXML_CONTENT;
|
||||
}
|
||||
|
||||
|
||||
static inline yxml_ret_t yxml_datapi1(yxml_t *x, unsigned ch) {
|
||||
static INLINE yxml_ret_t yxml_datapi1(yxml_t *x, unsigned ch) {
|
||||
yxml_setchar(x->data, ch);
|
||||
x->data[1] = 0;
|
||||
return YXML_PICONTENT;
|
||||
}
|
||||
|
||||
|
||||
static inline yxml_ret_t yxml_datapi2(yxml_t *x, unsigned ch) {
|
||||
static INLINE yxml_ret_t yxml_datapi2(yxml_t *x, unsigned ch) {
|
||||
x->data[0] = '?';
|
||||
yxml_setchar(x->data+1, ch);
|
||||
x->data[2] = 0;
|
||||
@ -169,7 +171,7 @@ static inline yxml_ret_t yxml_datapi2(yxml_t *x, unsigned ch) {
|
||||
}
|
||||
|
||||
|
||||
static inline yxml_ret_t yxml_datacd1(yxml_t *x, unsigned ch) {
|
||||
static INLINE yxml_ret_t yxml_datacd1(yxml_t *x, unsigned ch) {
|
||||
x->data[0] = ']';
|
||||
yxml_setchar(x->data+1, ch);
|
||||
x->data[2] = 0;
|
||||
@ -177,7 +179,7 @@ static inline yxml_ret_t yxml_datacd1(yxml_t *x, unsigned ch) {
|
||||
}
|
||||
|
||||
|
||||
static inline yxml_ret_t yxml_datacd2(yxml_t *x, unsigned ch) {
|
||||
static INLINE yxml_ret_t yxml_datacd2(yxml_t *x, unsigned ch) {
|
||||
x->data[0] = ']';
|
||||
x->data[1] = ']';
|
||||
yxml_setchar(x->data+2, ch);
|
||||
@ -186,7 +188,7 @@ static inline yxml_ret_t yxml_datacd2(yxml_t *x, unsigned ch) {
|
||||
}
|
||||
|
||||
|
||||
static inline yxml_ret_t yxml_dataattr(yxml_t *x, unsigned ch) {
|
||||
static INLINE yxml_ret_t yxml_dataattr(yxml_t *x, unsigned ch) {
|
||||
/* Normalize attribute values according to the XML spec section 3.3.3. */
|
||||
yxml_setchar(x->data, ch == 0x9 || ch == 0xa ? 0x20 : ch);
|
||||
x->data[1] = 0;
|
||||
@ -223,9 +225,9 @@ static void yxml_popstack(yxml_t *x) {
|
||||
}
|
||||
|
||||
|
||||
static inline yxml_ret_t yxml_elemstart (yxml_t *x, unsigned ch) { return yxml_pushstack(x, &x->elem, ch); }
|
||||
static inline yxml_ret_t yxml_elemname (yxml_t *x, unsigned ch) { return yxml_pushstackc(x, ch); }
|
||||
static inline yxml_ret_t yxml_elemnameend(yxml_t *x, unsigned ch) { return YXML_ELEMSTART; }
|
||||
static INLINE yxml_ret_t yxml_elemstart (yxml_t *x, unsigned ch) { return yxml_pushstack(x, &x->elem, ch); }
|
||||
static INLINE yxml_ret_t yxml_elemname (yxml_t *x, unsigned ch) { return yxml_pushstackc(x, ch); }
|
||||
static INLINE yxml_ret_t yxml_elemnameend(yxml_t *x, unsigned ch) { return YXML_ELEMSTART; }
|
||||
|
||||
|
||||
/* Also used in yxml_elemcloseend(), since this function just removes the last
|
||||
@ -244,7 +246,7 @@ static yxml_ret_t yxml_selfclose(yxml_t *x, unsigned ch) {
|
||||
}
|
||||
|
||||
|
||||
static inline yxml_ret_t yxml_elemclose(yxml_t *x, unsigned ch) {
|
||||
static INLINE yxml_ret_t yxml_elemclose(yxml_t *x, unsigned ch) {
|
||||
if(*((unsigned char *)x->elem) != ch)
|
||||
return YXML_ECLOSE;
|
||||
x->elem++;
|
||||
@ -252,29 +254,29 @@ static inline yxml_ret_t yxml_elemclose(yxml_t *x, unsigned ch) {
|
||||
}
|
||||
|
||||
|
||||
static inline yxml_ret_t yxml_elemcloseend(yxml_t *x, unsigned ch) {
|
||||
static INLINE yxml_ret_t yxml_elemcloseend(yxml_t *x, unsigned ch) {
|
||||
if(*x->elem)
|
||||
return YXML_ECLOSE;
|
||||
return yxml_selfclose(x, ch);
|
||||
}
|
||||
|
||||
|
||||
static inline yxml_ret_t yxml_attrstart (yxml_t *x, unsigned ch) { return yxml_pushstack(x, &x->attr, ch); }
|
||||
static inline yxml_ret_t yxml_attrname (yxml_t *x, unsigned ch) { return yxml_pushstackc(x, ch); }
|
||||
static inline yxml_ret_t yxml_attrnameend(yxml_t *x, unsigned ch) { return YXML_ATTRSTART; }
|
||||
static inline yxml_ret_t yxml_attrvalend (yxml_t *x, unsigned ch) { yxml_popstack(x); return YXML_ATTREND; }
|
||||
static INLINE yxml_ret_t yxml_attrstart (yxml_t *x, unsigned ch) { return yxml_pushstack(x, &x->attr, ch); }
|
||||
static INLINE yxml_ret_t yxml_attrname (yxml_t *x, unsigned ch) { return yxml_pushstackc(x, ch); }
|
||||
static INLINE yxml_ret_t yxml_attrnameend(yxml_t *x, unsigned ch) { return YXML_ATTRSTART; }
|
||||
static INLINE yxml_ret_t yxml_attrvalend (yxml_t *x, unsigned ch) { yxml_popstack(x); return YXML_ATTREND; }
|
||||
|
||||
|
||||
static inline yxml_ret_t yxml_pistart (yxml_t *x, unsigned ch) { return yxml_pushstack(x, &x->pi, ch); }
|
||||
static inline yxml_ret_t yxml_piname (yxml_t *x, unsigned ch) { return yxml_pushstackc(x, ch); }
|
||||
static inline yxml_ret_t yxml_piabort (yxml_t *x, unsigned ch) { yxml_popstack(x); return YXML_OK; }
|
||||
static inline yxml_ret_t yxml_pinameend(yxml_t *x, unsigned ch) {
|
||||
static INLINE yxml_ret_t yxml_pistart (yxml_t *x, unsigned ch) { return yxml_pushstack(x, &x->pi, ch); }
|
||||
static INLINE yxml_ret_t yxml_piname (yxml_t *x, unsigned ch) { return yxml_pushstackc(x, ch); }
|
||||
static INLINE yxml_ret_t yxml_piabort (yxml_t *x, unsigned ch) { yxml_popstack(x); return YXML_OK; }
|
||||
static INLINE yxml_ret_t yxml_pinameend(yxml_t *x, unsigned ch) {
|
||||
return (x->pi[0]|32) == 'x' && (x->pi[1]|32) == 'm' && (x->pi[2]|32) == 'l' && !x->pi[3] ? YXML_ESYN : YXML_PISTART;
|
||||
}
|
||||
static inline yxml_ret_t yxml_pivalend (yxml_t *x, unsigned ch) { yxml_popstack(x); x->pi = (char *)x->stack; return YXML_PIEND; }
|
||||
static INLINE yxml_ret_t yxml_pivalend (yxml_t *x, unsigned ch) { yxml_popstack(x); x->pi = (char *)x->stack; return YXML_PIEND; }
|
||||
|
||||
|
||||
static inline yxml_ret_t yxml_refstart(yxml_t *x, unsigned ch) {
|
||||
static INLINE yxml_ret_t yxml_refstart(yxml_t *x, unsigned ch) {
|
||||
memset(x->data, 0, sizeof(x->data));
|
||||
x->reflen = 0;
|
||||
return YXML_OK;
|
||||
@ -320,9 +322,8 @@ static yxml_ret_t yxml_refend(yxml_t *x, yxml_ret_t ret) {
|
||||
}
|
||||
|
||||
|
||||
static inline yxml_ret_t yxml_refcontent(yxml_t *x, unsigned ch) { return yxml_refend(x, YXML_CONTENT); }
|
||||
static inline yxml_ret_t yxml_refattrval(yxml_t *x, unsigned ch) { return yxml_refend(x, YXML_ATTRVAL); }
|
||||
|
||||
static INLINE yxml_ret_t yxml_refcontent(yxml_t *x, unsigned ch) { return yxml_refend(x, YXML_CONTENT); }
|
||||
static INLINE yxml_ret_t yxml_refattrval(yxml_t *x, unsigned ch) { return yxml_refend(x, YXML_ATTRVAL); }
|
||||
|
||||
void yxml_init(yxml_t *x, void *stack, size_t stacksize) {
|
||||
memset(x, 0, sizeof(*x));
|
||||
@ -1052,12 +1053,4 @@ yxml_ret_t yxml_parse(yxml_t *x, int _ch) {
|
||||
return YXML_ESYN;
|
||||
}
|
||||
|
||||
|
||||
yxml_ret_t yxml_eof(yxml_t *x) {
|
||||
if(x->state != YXMLS_misc3)
|
||||
return YXML_EEOF;
|
||||
return YXML_OK;
|
||||
}
|
||||
|
||||
|
||||
/* vim: set noet sw=4 ts=4: */
|
||||
|
29
deps/yxml/yxml.h
vendored
29
deps/yxml/yxml.h
vendored
@ -27,14 +27,6 @@
|
||||
#include <stddef.h>
|
||||
#include <retro_environment.h>
|
||||
|
||||
#if defined(_MSC_VER) && !defined(__cplusplus) && !defined(inline)
|
||||
#define inline __inline
|
||||
#endif
|
||||
|
||||
#if defined(__STDC_C89__) && !defined(inline)
|
||||
#define inline
|
||||
#endif
|
||||
|
||||
/* Full API documentation for this library can be found in the "yxml.pod" file
|
||||
* in the yxml git repository, or online at http://dev.yorhel.nl/yxml/man */
|
||||
|
||||
@ -135,33 +127,12 @@ extern "C" {
|
||||
|
||||
void yxml_init(yxml_t *, void *, size_t);
|
||||
|
||||
|
||||
yxml_ret_t yxml_parse(yxml_t *, int);
|
||||
|
||||
|
||||
/* May be called after the last character has been given to yxml_parse().
|
||||
* Returns YXML_OK if the XML document is valid, YXML_EEOF otherwise. Using
|
||||
* this function isn't really necessary, but can be used to detect documents
|
||||
* that don't end correctly. In particular, an error is returned when the XML
|
||||
* document did not contain a (complete) root element, or when the document
|
||||
* ended while in a comment or processing instruction. */
|
||||
yxml_ret_t yxml_eof(yxml_t *);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/* Returns the length of the element name (x->elem), attribute name (x->attr),
|
||||
* or PI name (x->pi). This function should ONLY be used directly after the
|
||||
* YXML_ELEMSTART, YXML_ATTRSTART or YXML_PISTART (respectively) tokens have
|
||||
* been returned by yxml_parse(), calling this at any other time may not give
|
||||
* the correct results. This function should also NOT be used on strings other
|
||||
* than x->elem, x->attr or x->pi. */
|
||||
static inline size_t yxml_symlen(yxml_t *x, const char *s) {
|
||||
return (x->stack + x->stacklen) - (const unsigned char*)s;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/* vim: set noet sw=4 ts=4: */
|
||||
|
Loading…
x
Reference in New Issue
Block a user