on master help sign in
More inline
36f8874Neil Mitchell
hexml.c+7−6
@@ -292,14 +292,14 @@ bool find(document* d, char c)
292/////////////////////////////////////////////////////////////////////
292/////////////////////////////////////////////////////////////////////
293// PARSING CODE
293// PARSING CODE
294
294
295−void node_alloc(node_buffer* b, int ask)
295+void static inline node_alloc(node_buffer* b, int ask)
296{
296{
297 int space = b->size - b->used_back - b->used_front;
297 int space = b->size - b->used_back - b->used_front;
298 if (space >= ask) return;
298 if (space >= ask) return;
299 assert(0);
299 assert(0);
300}
300}
301
301
302−void attr_alloc(attr_buffer* b, int ask)
302+void static inline attr_alloc(attr_buffer* b, int ask)
303{
303{
304 int space = b->size - b->used;
304 int space = b->size - b->used;
305 if (space >= ask) return;
305 if (space >= ask) return;
@@ -312,7 +312,7 @@ void attr_alloc(attr_buffer* b, int ask)
312
312
313// you now expect a name, perhaps preceeded by whitespace
313// you now expect a name, perhaps preceeded by whitespace
314// the name may be empty
314// the name may be empty
315−str parse_name(document* d)
315+str static inline parse_name(document* d)
316{
316{
317 trim(d);
317 trim(d);
318 int start = doc_position(d);
318 int start = doc_position(d);
@@ -324,7 +324,7 @@ str parse_name(document* d)
324 return start_end(start, doc_position(d));
324 return start_end(start, doc_position(d));
325}
325}
326
326
327−str parse_attrval(document* d)
327+str static inline parse_attrval(document* d)
328{
328{
329 trim(d);
329 trim(d);
330 if (peek(d) != '=') return start_length(0,0);
330 if (peek(d) != '=') return start_length(0,0);
@@ -351,7 +351,7 @@ str parse_attrval(document* d)
351
351
352// seen a tag name, now looking for attributes terminated by >
352// seen a tag name, now looking for attributes terminated by >
353// puts the attributes it finds in the attribute buffer
353// puts the attributes it finds in the attribute buffer
354−str parse_attributes(document* d)
354+str static inline parse_attributes(document* d)
355{
355{
356 str res;
356 str res;
357 res.start = d->attrs.used;
357 res.start = d->attrs.used;
@@ -372,7 +372,7 @@ str parse_content(document* d);
372
372
373
373
374// Add a new entry into tag, am at a '<'
374// Add a new entry into tag, am at a '<'
375−void parse_tag(document* d)
375+void static inline parse_tag(document* d)
376{
376{
377 node_alloc(&d->nodes, 1);
377 node_alloc(&d->nodes, 1);
378 d->nodes.used_back++;
378 d->nodes.used_back++;
@@ -426,6 +426,7 @@ void parse_tag(document* d)
426}
426}
427
427
428// Parser until </, return the index of your node children
428// Parser until </, return the index of your node children
429+// Not inline as it is recursive
429str parse_content(document* d)
430str parse_content(document* d)
430{
431{
431 int before = d->nodes.used_back;
432 int before = d->nodes.used_back;