Browse Source

Fixed xml.c verbosity in debug builds

Squashed commit of the following:

commit 9ed7fee198
Author: ooxi <85fcd0ef4ec8@f977375cdcd6.anonbox.net>
Date:   Thu Nov 1 18:20:04 2012 +0100

    xml.c parser verbosity

commit 97d4cbade8
Author: ooxi <85fcd0ef4ec8@f977375cdcd6.anonbox.net>
Date:   Thu Nov 1 18:19:21 2012 +0100

    xml.c parser verbosity

commit 8c5493710b
Author: ooxi <85fcd0ef4ec8@f977375cdcd6.anonbox.net>
Date:   Thu Nov 1 18:17:13 2012 +0100

    xml.c parser verbosity

commit 3a793c8c7d
Author: ooxi <85fcd0ef4ec8@f977375cdcd6.anonbox.net>
Date:   Thu Nov 1 18:16:37 2012 +0100

    xml parser verbosity
master
ooxi 12 years ago
parent
commit
10d1ef9a20
3 changed files with 10 additions and 3 deletions
  1. +1
    -1
      .travis.yml
  2. +7
    -0
      CMakeLists.txt
  3. +2
    -2
      src/xml.c

+ 1
- 1
.travis.yml View File

@@ -4,5 +4,5 @@ compiler:
before_install:
- sudo apt-get install cmake valgrind
script:
- mkdir build && cd build && cmake -DCMAKE_BUILD_TYPE=Debug .. && make && ./test-xml && valgrind --tool=memcheck --leak-check=full --track-origins=yes -v ./test-xml
- mkdir build && cd build && cmake -DCMAKE_BUILD_TYPE=Debug -DXML_PARSER_VERBOSE=On .. && make && ./test-xml && valgrind --tool=memcheck --leak-check=full --track-origins=yes -v ./test-xml


+ 7
- 0
CMakeLists.txt View File

@@ -10,6 +10,13 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.6.0 FATAL_ERROR)
SET(CMAKE_C_FLAGS_DEBUG "-g -DDEBUG")
SET(CMAKE_C_FLAGS_RELEASE "-O2")
# Options
OPTION(XML_PARSER_VERBOSE "Enable to be told everything the xml parser does" OFF)
IF(XML_PARSER_VERBOSE)
ADD_DEFINITIONS(-DXML_PARSER_VERBOSE)
ENDIF(XML_PARSER_VERBOSE)
# Sources
SET(SOURCE_DIRECTORY src)


+ 2
- 2
src/xml.c View File

@@ -196,7 +196,7 @@ static void xml_node_free(struct xml_node* node) {
*
* Echos the parsers call stack for debugging purposes
*/
#ifdef DEBUG
#ifdef XML_PARSER_VERBOSE
static void xml_parser_info(struct xml_parser* parser, char const* message) {
fprintf(stdout, "xml_parser_info %s\n", message);
}
@@ -279,7 +279,7 @@ static void xml_parser_consume(struct xml_parser* parser, size_t n) {

/* Debug information
*/
#ifdef DEBUG
#ifdef XML_PARSER_VERBOSE
#define min(X,Y) ((X) < (Y) ? (X) : (Y))
char* consumed = alloca((n + 1) * sizeof(char));
memcpy(consumed, &parser->buffer[parser->position], min(n, parser->length - parser->position));


Loading…
Cancel
Save