Re: [xml] xmlIO enhancements?



On Tue, Apr 05, 2005 at 01:34:32PM -0400, Daniel Veillard wrote:
On Tue, Apr 05, 2005 at 01:22:50PM -0400, Joel Reed wrote:
I'm reviewing xmlFileOpen_real and xmlGzfileOpen_real in xmlIO.c and have
two quick questions/possible improvements (i'll fire off a patch if no
dissenters).

1) xmlFileOpen_real does a

  if (!xmlCheckFilename(path)) return(NULL);

before the fopen(path, "r") call. This quick-out prevents library users
from ever seeing a message in their structure error handler like
"No such file or directory." By deleting this check, we can let fopen call
fail and set errno, then let normal libxml error handling bubble the
error back up to library users. Any reason why not to do this?

   the optimistic way might be better yes. Might be faster too, see

http://bugzilla.gnome.org/show_bug.cgi?id=168414

ok, did the patch & i think it uncovered a few test case inconsistencies.
for example in XMLtests, we do:

1) $(top_builddir)/xmllint test/$$i 2>&1 > result.$$name
2) $(top_builddir)/xmllint result.$$name

this fails for test/ent2 which has a line:

  <!ENTITY title PUBLIC "-//MY-TITLE//FR" "title.xml">

it fails because title.xml is in test/ and #2 above produces a 
"No such file or directory I/O error." because "result.$$name"
is not in test/

basically, the patch is making visible these errors which silently failed 
before. 

how should i fix the testcases? would it be acceptable to say 

1) $(top_builddir)/xmllint test/$$i 2>&1 > test/result.$$name
2) $(top_builddir)/xmllint test/result.$$name

jr




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]