From f9d8f1df7f34dd93a061fbb49dadefb9a973d35a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Nicolas=20L=C3=A9veill=C3=A9?= <nicolas@uucidl.com>
Date: Sun, 31 Jan 2016 18:11:27 +0100
Subject: [PATCH] Reactivate examples that can build on windows

This is proof that Hammer can be linked and used in a windows
program!
---
 appveyor.yml       | 3 +--
 examples/grammar.c | 7 ++++---
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/appveyor.yml b/appveyor.yml
index 2aef9c94..b0d87a79 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -14,6 +14,5 @@ build_script:
     }
 - call "%VS140COMNTOOLS%\..\..\VC\vcvarsall.bat" %VCVARS_PLATFORM%
 - call tools\windows\build.bat
-# FIXME(windows) TODO(uucidl): reactivate examples
-# - call tools\windows\build_examples.bat
+- call tools\windows\build_examples.bat
 - exit /b 0
diff --git a/examples/grammar.c b/examples/grammar.c
index 7638fe99..a768060b 100644
--- a/examples/grammar.c
+++ b/examples/grammar.c
@@ -22,11 +22,12 @@
 const char *nonterminal_name(const HCFGrammar *g, const HCFChoice *nt) {
   // if user_data exists and is printable:
   if(nt->user_data != NULL && *(char*)(nt->user_data) > ' ' && *(char*)(nt->user_data) < 127) {
-    if(*(char*)(nt->user_data) != '0') {
+    char* user_str = (char*)(nt->user_data);
+    if(*user_str != '\0') {
       // user_data is a non-empty string
-      return nt->user_data;
+      return user_str;
     } else {
-      return nt->user_data+1;
+      return user_str+1;
     }
   }
   
-- 
GitLab