Don't redefine namespaces in C.

The Oga::XML namespace should be set up by Ruby, not by C.
This commit is contained in:
Yorick Peterse 2014-05-07 10:51:50 +02:00
parent bbdc7966db
commit ee78b2c382
7 changed files with 5 additions and 35 deletions

View File

@ -11,8 +11,6 @@ ext/c/lexer.h
ext/c/lexer.rl
ext/c/liboga.c
ext/c/liboga.h
ext/c/xml.c
ext/c/xml.h
ext/java/LibogaService.java
ext/java/org/liboga/xml/Lexer.java
ext/java/org/liboga/xml/Lexer.rl
@ -30,4 +28,4 @@ lib/oga/xml/parser.rb
lib/oga/xml/pull_parser.rb
lib/oga/xml/text.rb
lib/oga/xml/xml_declaration.rb
oga.gemspec
oga.gemspec

View File

@ -3,8 +3,6 @@
#ifndef LIBOGA_XML_LEXER_H
#define LIBOGA_XML_LEXER_H
extern VALUE oga_cLexer;
extern void Init_liboga_xml_lexer();
#endif

View File

@ -16,8 +16,6 @@ on `ts` and `te`) so the macro ignores this argument.
#define callback_simple(name) \
liboga_xml_lexer_callback_simple(self, name);
VALUE oga_cLexer;
%%machine c_lexer;
/**
@ -106,7 +104,9 @@ VALUE oga_xml_lexer_advance(VALUE self)
void Init_liboga_xml_lexer()
{
oga_cLexer = rb_define_class_under(oga_mXML, "Lexer", rb_cObject);
VALUE mOga = rb_const_get(rb_cObject, rb_intern("Oga"));
VALUE mXML = rb_const_get(mOga, rb_intern("XML"));
VALUE cLexer = rb_define_class_under(mXML, "Lexer", rb_cObject);
rb_define_method(oga_cLexer, "advance_native", oga_xml_lexer_advance, 0);
rb_define_method(cLexer, "advance_native", oga_xml_lexer_advance, 0);
}

View File

@ -1,11 +1,6 @@
#include "liboga.h"
VALUE oga_mOga;
void Init_liboga()
{
oga_mOga = rb_define_module("Oga");
Init_liboga_xml();
Init_liboga_xml_lexer();
}

View File

@ -6,9 +6,6 @@
#include <malloc.h>
#include <stdio.h>
extern VALUE oga_mOga;
#include "xml.h"
#include "lexer.h"
void Init_liboga();

View File

@ -1,8 +0,0 @@
#include "xml.h"
VALUE oga_mXML;
void Init_liboga_xml()
{
oga_mXML = rb_define_module_under(oga_mOga, "XML");
}

View File

@ -1,10 +0,0 @@
#ifndef LIBOGA_XML_H
#define LIBOGA_XML_H
#include "liboga.h"
extern VALUE oga_mXML;
void Init_liboga_xml();
#endif