Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Remove deprecated GetFeaturesList #7

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 0 additions & 32 deletions xml_parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,6 @@ package golibxml
static inline void free_string(char* s) { free(s); }
static inline xmlChar *to_xmlcharptr(const char *s) { return (xmlChar *)s; }
static inline char *to_charptr(const xmlChar *s) { return (char *)s; }
static inline int *new_int_ptr(int value) {
int *ptr = calloc(sizeof(int), 1);
*ptr = value;
return ptr;
}
static inline char **new_char_array(int size) { return calloc(sizeof(char *), size); }
static inline void set_char_array_string(char **ptr, char *str, int n) { ptr[n] = str; }
static inline char *get_char_array_string(char **ptr, int n) {
return ptr[n];
}
*/
import "C"
import "unsafe"
Expand Down Expand Up @@ -120,28 +110,6 @@ func (p *Parser) Free() {
C.xmlFreeParserCtxt(p.Ptr)
}

// xmlGetFeaturesList
func GetFeaturesList() []string {
// Get list in C land
clength := C.new_int_ptr(255)
defer C.free(unsafe.Pointer(clength))
clist := C.new_char_array(255)
defer C.free(unsafe.Pointer(clist))
result := C.xmlGetFeaturesList(clength, clist)
if result < 0 {
panic("ERROR TO BE HANDLED")
}

// Convert to Go land
length := int(*clength)
list := make([]string, length)
for i := 0; i < length; i++ {
list[i] = C.GoString(C.get_char_array_string(clist, C.int(i)))
}

return list
}

// xmlNewParserCtxt
func NewParser() *Parser {
pctx := C.xmlNewParserCtxt()
Expand Down
7 changes: 0 additions & 7 deletions xml_parser_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,6 @@ func compareResult(t *testing.T, got string, expected string) {
}
}

func TestGetFeaturesList(t *testing.T) {
features := GetFeaturesList()
if len(features) != 42 {
t.Fail()
}
}

func TestParseDtd(t *testing.T) {
dtd := ParseDTD("1", "test/test.dtd")
if dtd == nil {
Expand Down