Changeset 3452
- Timestamp:
- 08/09/07 13:22:16 (1 year ago)
- Files:
-
- branches/common-nfo/tools/nfotiser/parser.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/common-nfo/tools/nfotiser/parser.c
r3449 r3452 98 98 err(255, "cannot stat"); 99 99 100 buf = mmap(NULL, (len = sb.st_size), PROT_READ, MAP_FILE, fd, 0); 101 if (buf == MAP_FAILED) 100 /* slurp whole file into mapped memory */ 101 if ((cp = mmap(NULL, (len = sb.st_size), PROT_READ, MAP_FILE, fd, 0)) 102 == MAP_FAILED) 102 103 err(255, "cannot mmap %zu bytes", len); 104 /* make a nice NUL-terminated copy (malloc'd) */ 105 buf = str_nsave(cp, len); 106 if (munmap(cp, len)) 107 err(255, "cannot munmap"); 108 /* don't need the file any more */ 109 close(fd); 103 110 111 /* now we can operate on the NUL-terminated R/W string “buf” */


