English Language flag
// Log In
// CVSweb
Project: FreeWRT
// Summary // Activity // Search // Tracker // Lists // News // SCM // Wiki

SCM Repository

ViewVC logotype

Diff of /branches/common-nfo/tools/nfotiser/parser.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 3456 by tg, Thu Aug 9 13:18:23 2007 UTC revision 3457 by tg, Thu Aug 9 13:40:07 2007 UTC
# Line 39  Line 39 
39  #include <stdio.h>  #include <stdio.h>
40  #include <stdlib.h>  #include <stdlib.h>
41  #include <string.h>  #include <string.h>
42  #include <unistd.h>  //#include <unistd.h>
43    
44  #include "nfotiser.h"  #include "nfotiser.h"
45    
# Line 109  nfo_parse(int fd, const struct parser_ke Line 109  nfo_parse(int fd, const struct parser_ke
109          if (munmap(cp, len))          if (munmap(cp, len))
110                  err(255, "cannot munmap");                  err(255, "cannot munmap");
111          /* don't need the file any more */          /* don't need the file any more */
         close(fd);  
112    
113          /* now we can operate on the NUL-terminated R/W string “buf” */          /* now we can operate on the NUL-terminated R/W string “buf” */
114          if (buf[len - 1] != '\n')          if (buf[len - 1] != '\n')
# Line 277  parser_dump(struct parser_res *entry, co Line 276  parser_dump(struct parser_res *entry, co
276          }          }
277          putchar('\n');          putchar('\n');
278  }  }
279    
280    void
281    parser_free(struct parser_result *head)
282    {
283            struct parser_res *entry;
284    
285            if (head == NULL)
286                    return;
287    
288            while (!CIRCLEQ_EMPTY(head)) {
289                    entry = CIRCLEQ_FIRST(head);
290                    CIRCLEQ_REMOVE(head, entry, e);
291                    if (entry->kw_multi != NULL)
292                            free(entry->kw_multi);
293                    if (entry->value != NULL)
294                            free(entry->value);
295                    free(entry);
296            }
297    
298            free(head);
299    }

Legend:
Removed from v.3456  
changed lines
  Added in v.3457

root@freewrt.org:443
ViewVC Help
Powered by ViewVC 1.1.20