Date: Fri, 19 Jul 2013 08:46:33 GMT From: dpl@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r254943 - in soc2013/dpl/head: contrib/xz/src/xz usr.bin/xz Message-ID: <201307190846.r6J8kX5e087425@socsvn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: dpl Date: Fri Jul 19 08:46:33 2013 New Revision: 254943 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=254943 Log: Finished with xz! Modified: soc2013/dpl/head/contrib/xz/src/xz/file_io.c soc2013/dpl/head/contrib/xz/src/xz/main.c soc2013/dpl/head/contrib/xz/src/xz/main.h soc2013/dpl/head/usr.bin/xz/Makefile Modified: soc2013/dpl/head/contrib/xz/src/xz/file_io.c ============================================================================== --- soc2013/dpl/head/contrib/xz/src/xz/file_io.c Fri Jul 19 06:42:15 2013 (r254942) +++ soc2013/dpl/head/contrib/xz/src/xz/file_io.c Fri Jul 19 08:46:33 2013 (r254943) @@ -102,7 +102,6 @@ const char *name; int fd; struct stat *known_st; - //const char *name, int *fd, int *dirfd, const struct stat *known_st) if (dest) { name = pair->dest_name; fd = &pair->dest_fd; @@ -987,9 +986,6 @@ message_fatal(_("--list works only on .xz files " "(--format=xz or --format=auto)")); - for ( i = 0; i<files; i++) - printf("filename[%d]: %s\n", i, filename[i]); - for ( i = 0; i<files; i++) { if (filename[i] == NULL) continue; Modified: soc2013/dpl/head/contrib/xz/src/xz/main.c ============================================================================== --- soc2013/dpl/head/contrib/xz/src/xz/main.c Fri Jul 19 06:42:15 2013 (r254942) +++ soc2013/dpl/head/contrib/xz/src/xz/main.c Fri Jul 19 08:46:33 2013 (r254943) @@ -134,7 +134,6 @@ name = xrealloc(name, size); } } - return NULL; } @@ -142,9 +141,10 @@ int main(int argc, char **argv) { - int forkpid, i, nfiles = 0; + int forkpid, i, nfiles=0; //Filenames will be here, and get passed to io_open_files(). - char **files = (char **)malloc(sizeof(char **)); + // If we get past of 8 elements, realloc 8 more. + char **files = malloc( 8*sizeof(char*) ); #if defined(_WIN32) && !defined(__CYGWIN__) InitializeCriticalSection(&exit_status_cs); @@ -218,6 +218,9 @@ // Process the files given on the command line. Note that if no names // were given, args_parse() gave us a fake "-" filename. for ( i = 0; i < (int)args.arg_count && !user_abort; i++, nfiles++) { + if (nfiles % 8 == 0 && nfiles != 0) + files = realloc(files, (nfiles+8)*sizeof(char*)); + if (strcmp("-", args.arg_names[i]) == 0) { // Processing from stdin to stdout. Check that we // aren't writing compressed data to a terminal or @@ -245,20 +248,16 @@ // This way error messages get a proper filename // string and the code still knows that it is // handling the special case of stdin. - size_t len = strlen(stdin_filename) + 1; + size_t len = strlen(stdin_filename)+1; files[i] = malloc(len); strncpy(files[i], stdin_filename, len); - files[i][len] = '\0'; } else { - size_t len = strlen(args.arg_names[i]) +1; + size_t len = strlen(args.arg_names[i])+1; files[i] = malloc(len); strncpy(files[i], args.arg_names[i], len); - files[i][len] = '\0'; } } - printf("files[0]: %s\n", files[0]); - // If --files or --files0 was used, process the filenames from the // given file or stdin. Note that here we don't consider "-" to // indicate stdin like we do with the command line arguments. @@ -272,10 +271,11 @@ // read_name() doesn't return empty names. assert(name[0] != '\0'); - size_t len = strlen(name) + 1; + if (nfiles % 8 == 0 && nfiles != 0) + files = realloc(files, (nfiles+8)*sizeof(char*)); + size_t len = strlen(name)+1; files[nfiles] = malloc(len); files[nfiles] = strncpy(files[nfiles], name, len); - files[nfiles][len] = '\0'; nfiles++; } if (args.files_name != stdin_filename) Modified: soc2013/dpl/head/contrib/xz/src/xz/main.h ============================================================================== --- soc2013/dpl/head/contrib/xz/src/xz/main.h Fri Jul 19 06:42:15 2013 (r254942) +++ soc2013/dpl/head/contrib/xz/src/xz/main.h Fri Jul 19 08:46:33 2013 (r254943) @@ -17,9 +17,6 @@ E_WARNING = 2, }; -// To be used with unlinkat(), fstatat() at io_close(). -int dirfd; - /// Sets the exit status after a warning or error has occurred. If new_status /// is E_WARNING and the old exit status was already E_ERROR, the exit /// status is not changed. Modified: soc2013/dpl/head/usr.bin/xz/Makefile ============================================================================== --- soc2013/dpl/head/usr.bin/xz/Makefile Fri Jul 19 06:42:15 2013 (r254942) +++ soc2013/dpl/head/usr.bin/xz/Makefile Fri Jul 19 08:46:33 2013 (r254943) @@ -41,9 +41,7 @@ CFLAGS+= -DHAVE_CONFIG_H \ -I${LZMALIBDIR} \ -I${XZDIR}/common -#TODO: Delete this. -CFLAGS+= -fno-color-diagnostics -CFLAGS+= -Wall -Werror -g + DPADD= ${LIBLZMA} LDADD= -llzma
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201307190846.r6J8kX5e087425>