[libimdb-commit] CVS: libimdb/parser imdbParser.c,1.2,1.3
Status: Pre-Alpha
Brought to you by:
jveldhuis
|
From: Jerry V. <jve...@us...> - 2003-08-22 09:43:21
|
Update of /cvsroot/libimdb/libimdb/parser
In directory sc8-pr-cvs1:/tmp/cvs-serv6416
Modified Files:
imdbParser.c
Log Message:
listEntry_callback is now optional (parse testing)
Index: imdbParser.c
===================================================================
RCS file: /cvsroot/libimdb/libimdb/parser/imdbParser.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** imdbParser.c 17 Aug 2003 16:41:51 -0000 1.2
--- imdbParser.c 21 Aug 2003 22:44:31 -0000 1.3
***************
*** 312,318 ****
#endif
! #define TO_END_OF_LINE -1
!
! static /*inline */int
deleteChars(struct line_s *line, int start, int length)
{
--- 312,316 ----
#endif
! static inline int
deleteChars(struct line_s *line, int start, int length)
{
***************
*** 322,339 ****
dumpLine(buf, line);
}*/
! if ( start == 0 ) {
! line->used-=length;
! memcpy(line->buf, line->buf+length, line->used);
! line->buf[line->used]='\0';
! }
! else if ( start+length == line->used ) {
line->used-=length;
line->buf[line->used]='\0';
}
else {
! /*memcpy(line->buf, line->buf, start-1);*/
! memcpy(line->buf+start-1, line->buf+start+length, line->used-length);
line->used-=length;
! line->buf[line->used]='\0';
}
/*{
--- 320,337 ----
dumpLine(buf, line);
}*/
! if ( start+length == line->used ) {
! /* simple truncation */
line->used-=length;
line->buf[line->used]='\0';
}
else {
! /* start may be 0 */
! char *s,*d;
!
line->used-=length;
! for (d=line->buf+start,s=d+length ; *s != '\0' ; *d++=*s++ ) {
! }
! *d='\0';
! assert(d-line->buf == line->used);
}
/*{
***************
*** 391,394 ****
--- 389,394 ----
}
+ #define TO_END_OF_LINE -1
+
static inline int
subLine(struct line_s *line, struct line_s *newline, int start, int length)
***************
*** 732,738 ****
entry.yearRomanNumberals=results.romanNumberalsInYear;
! ret=parser->listEntry_cb(logh, parser, LIST_MOVIES, &entry);
! if ( ret != 0 ) {
! /* stop parsing and return this error code */
parseAbortCode=ret;
break;
--- 732,738 ----
entry.yearRomanNumberals=results.romanNumberalsInYear;
! if ( parser->listEntry_cb != NULL &&
! (ret=parser->listEntry_cb(logh, parser, LIST_MOVIES, &entry)) != 0 ) {
! /* stop parsing and return this error code */
parseAbortCode=ret;
break;
***************
*** 1103,1111 ****
parser->stats.directorsList.numDirectors++;
! ret=parser->listEntry_cb(logh, parser, lf, &entry);
! if ( ret != 0 ) {
! /* stop parsing and return this error code */
! parseAbortCode=ret;
! break;
}
}
--- 1103,1111 ----
parser->stats.directorsList.numDirectors++;
! if ( parser->listEntry_cb != NULL &&
! (ret=parser->listEntry_cb(logh, parser, lf, &entry)) != 0 ) {;
! /* stop parsing and return this error code */
! parseAbortCode=ret;
! break;
}
}
***************
*** 1139,1144 ****
}
! ret=parser->listEntry_cb(logh, parser, lf, &entry);
! if ( ret != 0 ) {
/* stop parsing and return this error code */
parseAbortCode=ret;
--- 1139,1144 ----
}
! if ( parser->listEntry_cb != NULL &&
! (ret=parser->listEntry_cb(logh, parser, lf, &entry)) != 0 ) {
/* stop parsing and return this error code */
parseAbortCode=ret;
|