]> git.wincent.com - wikitext.git/commitdiff
Redefine TOKEN_TEXT in terms of TOKEN_LEN
authorWincent Colaiuta <win@wincent.com>
Fri, 8 May 2009 10:53:03 +0000 (12:53 +0200)
committerWincent Colaiuta <win@wincent.com>
Fri, 8 May 2009 10:53:03 +0000 (12:53 +0200)
Rather than having both macros calculate the token length, do
it in one macro only and re-use that in the other one.

Signed-off-by: Wincent Colaiuta <win@wincent.com>
ext/token.h

index 37a76c21059d5dee5f461a6a1e39a3597377c487..76c99c9d66ff73d054c73fb295f2b8c18316d8c0 100644 (file)
@@ -24,8 +24,8 @@
 #include "ruby_compat.h"
 #include <stdint.h>     /* uint32_t */
 
-#define TOKEN_TEXT(token)   rb_str_new((const char *)token->start, (token->stop - token->start))
 #define TOKEN_LEN(token)    (token->stop - token->start)
+#define TOKEN_TEXT(token)   rb_str_new((const char *)token->start, TOKEN_LEN(token))
 
 typedef struct
 {