Code cleanup
This commit is contained in:
parent
e50be89137
commit
57e7b514e6
|
@ -1,5 +1,5 @@
|
||||||
/* $Id$ */
|
/* $Id$ */
|
||||||
/* Copyright (c) 2010 Pierre Pronchery <khorben@defora.org> */
|
/* Copyright (c) 2011 Pierre Pronchery <khorben@defora.org> */
|
||||||
/* This file is part of DeforaOS System libSystem */
|
/* This file is part of DeforaOS System libSystem */
|
||||||
/* This program is free software: you can redistribute it and/or modify
|
/* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -35,7 +35,7 @@ typedef struct _ParserCallbackData ParserCallbackData;
|
||||||
struct _Parser
|
struct _Parser
|
||||||
{
|
{
|
||||||
/* parsing sources */
|
/* parsing sources */
|
||||||
char * filename;
|
String * filename;
|
||||||
FILE * fp;
|
FILE * fp;
|
||||||
char * string;
|
char * string;
|
||||||
size_t string_cnt;
|
size_t string_cnt;
|
||||||
|
@ -163,7 +163,7 @@ Parser * parser_new(char const * pathname)
|
||||||
#endif
|
#endif
|
||||||
if((parser = _new_do(_parser_scanner_file)) == NULL)
|
if((parser = _new_do(_parser_scanner_file)) == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
if((parser->filename = strdup(pathname)) == NULL)
|
if((parser->filename = string_new(pathname)) == NULL)
|
||||||
error_set_code(1, "%s", strerror(errno));
|
error_set_code(1, "%s", strerror(errno));
|
||||||
if((parser->fp = fopen(pathname, "r")) == NULL)
|
if((parser->fp = fopen(pathname, "r")) == NULL)
|
||||||
error_set_code(1, "%s: %s", pathname, strerror(errno));
|
error_set_code(1, "%s: %s", pathname, strerror(errno));
|
||||||
|
@ -235,7 +235,7 @@ int parser_delete(Parser * parser)
|
||||||
&& fclose(parser->fp) != 0)
|
&& fclose(parser->fp) != 0)
|
||||||
ret = error_set_code(1, "%s: %s", parser->filename,
|
ret = error_set_code(1, "%s: %s", parser->filename,
|
||||||
strerror(errno));
|
strerror(errno));
|
||||||
free(parser->filename);
|
string_delete(parser->filename);
|
||||||
free(parser->string);
|
free(parser->string);
|
||||||
free(parser->filters);
|
free(parser->filters);
|
||||||
free(parser->callbacks);
|
free(parser->callbacks);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user