svn commit: samba r8712 - in branches/SAMBA_4_0/source/torture/raw: .

tridge at samba.org tridge at samba.org
Fri Jul 22 10:58:50 GMT 2005


Author: tridge
Date: 2005-07-22 10:58:49 +0000 (Fri, 22 Jul 2005)
New Revision: 8712

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=8712

Log:
cleanup old search test code to use talloc

Modified:
   branches/SAMBA_4_0/source/torture/raw/search.c


Changeset:
Modified: branches/SAMBA_4_0/source/torture/raw/search.c
===================================================================
--- branches/SAMBA_4_0/source/torture/raw/search.c	2005-07-22 10:48:22 UTC (rev 8711)
+++ branches/SAMBA_4_0/source/torture/raw/search.c	2005-07-22 10:58:49 UTC (rev 8712)
@@ -625,14 +625,14 @@
 	printf("Creating %d files\n", num_files);
 
 	for (i=0;i<num_files;i++) {
-		asprintf(&fname, BASEDIR "\\t%03d-%d.txt", i, i);
+		fname = talloc_asprintf(cli, BASEDIR "\\t%03d-%d.txt", i, i);
 		fnum = smbcli_open(cli->tree, fname, O_CREAT|O_RDWR, DENY_NONE);
 		if (fnum == -1) {
 			printf("Failed to create %s - %s\n", fname, smbcli_errstr(cli->tree));
 			ret = False;
 			goto done;
 		}
-		free(fname);
+		talloc_free(fname);
 		smbcli_close(cli->tree, fnum);
 	}
 
@@ -685,13 +685,13 @@
 			} else {
 				s = result.list[i].search.name;
 			}
-			asprintf(&fname, "t%03d-%d.txt", i, i);
+			fname = talloc_asprintf(cli, "t%03d-%d.txt", i, i);
 			if (strcmp(fname, s)) {
 				printf("Incorrect name %s at entry %d\n", s, i);
 				ret = False;
 				break;
 			}
-			free(fname);
+			talloc_free(fname);
 		}
 		talloc_free(result.mem_ctx);
 	}
@@ -758,14 +758,14 @@
 	printf("Creating %d files\n", num_files);
 
 	for (i=num_files-1;i>=0;i--) {
-		asprintf(&fname, BASEDIR "\\t%03d-%d.txt", i, i);
+		fname = talloc_asprintf(cli, BASEDIR "\\t%03d-%d.txt", i, i);
 		fnum = smbcli_open(cli->tree, fname, O_CREAT|O_RDWR, DENY_NONE);
 		if (fnum == -1) {
 			printf("Failed to create %s - %s\n", fname, smbcli_errstr(cli->tree));
 			ret = False;
 			goto done;
 		}
-		free(fname);
+		talloc_free(fname);
 		smbcli_close(cli->tree, fnum);
 	}
 
@@ -876,14 +876,14 @@
 	printf("Creating %d files\n", num_files);
 
 	for (i=0;i<num_files;i++) {
-		asprintf(&fname, BASEDIR "\\%s.txt", generate_random_str_list(mem_ctx, 10, "abcdefgh"));
+		fname = talloc_asprintf(cli, BASEDIR "\\%s.txt", generate_random_str_list(mem_ctx, 10, "abcdefgh"));
 		fnum = smbcli_open(cli->tree, fname, O_CREAT|O_RDWR, DENY_NONE);
 		if (fnum == -1) {
 			printf("Failed to create %s - %s\n", fname, smbcli_errstr(cli->tree));
 			ret = False;
 			goto done;
 		}
-		free(fname);
+		talloc_free(fname);
 		smbcli_close(cli->tree, fnum);
 	}
 
@@ -939,7 +939,7 @@
 	printf("Creating %d dirs\n", num_dirs);
 
 	for (i=0;i<num_dirs;i++) {
-		asprintf(&dname, BASEDIR "\\d%d", i);
+		dname = talloc_asprintf(cli, BASEDIR "\\d%d", i);
 		status = smbcli_mkdir(cli->tree, dname);
 		if (!NT_STATUS_IS_OK(status)) {
 			printf("(%s) Failed to create %s - %s\n", 
@@ -949,7 +949,7 @@
 		}
 
 		for (n=0;n<3;n++) {
-			asprintf(&fname, BASEDIR "\\d%d\\f%d-%d.txt", i, i, n);
+			fname = talloc_asprintf(cli, BASEDIR "\\d%d\\f%d-%d.txt", i, i, n);
 			fnum = smbcli_open(cli->tree, fname, O_CREAT|O_RDWR, DENY_NONE);
 			if (fnum == -1) {
 				printf("(%s) Failed to create %s - %s\n", 
@@ -957,11 +957,11 @@
 				ret = False;
 				goto done;
 			}
-			free(fname);
+			talloc_free(fname);
 			smbcli_close(cli->tree, fnum);
 		}
 
-		free(dname);
+		talloc_free(dname);
 	}
 
 	file  = talloc_zero_array(mem_ctx, union smb_search_data, num_dirs);
@@ -1103,14 +1103,14 @@
 	printf("Testing OS/2 style delete on %d files\n", num_files);
 
 	for (i=0;i<num_files;i++) {
-		asprintf(&fname, BASEDIR "\\file%u.txt", i);
+		fname = talloc_asprintf(cli, BASEDIR "\\file%u.txt", i);
 		fnum = smbcli_open(cli->tree, fname, O_CREAT|O_RDWR, DENY_NONE);
 		if (fnum == -1) {
 			printf("Failed to create %s - %s\n", fname, smbcli_errstr(cli->tree));
 			ret = False;
 			goto done;
 		}
-		free(fname);
+		talloc_free(fname);
 		smbcli_close(cli->tree, fnum);
 	}
 
@@ -1130,10 +1130,11 @@
 	CHECK_STATUS(status, NT_STATUS_OK);
 
 	for (i=0;i<MIN(result.count, delete_count);i++) {
-		asprintf(&fname, BASEDIR "\\%s", result.list[i].ea_size.name.s);
+		fname = talloc_asprintf(cli, BASEDIR "\\%s", result.list[i].ea_size.name.s);
 		status = smbcli_unlink(cli->tree, fname);
 		CHECK_STATUS(status, NT_STATUS_OK);
 		total_deleted++;
+		talloc_free(fname);
 	}
 
 	io2.t2fnext.level = RAW_SEARCH_EA_SIZE;
@@ -1154,10 +1155,11 @@
 		}
 
 		for (i=0;i<MIN(result.count, delete_count);i++) {
-			asprintf(&fname, BASEDIR "\\%s", result.list[i].ea_size.name.s);
+			fname = talloc_asprintf(cli, BASEDIR "\\%s", result.list[i].ea_size.name.s);
 			status = smbcli_unlink(cli->tree, fname);
 			CHECK_STATUS(status, NT_STATUS_OK);
 			total_deleted++;
+			talloc_free(fname);
 		}
 
 		if (i>0) {



More information about the samba-cvs mailing list