Patchwork [35/35] fs-tests: integck: assume that the parent is present in new_dir

login
register
mail settings
Submitter Artem Bityutskiy
Date April 20, 2011, 10:19 a.m.
Message ID <1303294748-5492-36-git-send-email-dedekind1@gmail.com>
Download mbox | patch
Permalink /patch/92171/
State New
Headers show

Comments

Artem Bityutskiy - April 20, 2011, 10:19 a.m.
From: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>

We always pass non-NULL 'parent' argument to 'new_dir()', so no need to
test it for NULL.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
---
 tests/fs-tests/integrity/integck.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

Patch

diff --git a/tests/fs-tests/integrity/integck.c b/tests/fs-tests/integrity/integck.c
index 310e228..9cb0403 100644
--- a/tests/fs-tests/integrity/integck.c
+++ b/tests/fs-tests/integrity/integck.c
@@ -455,6 +455,8 @@  static int dir_new(struct dir_info *parent, const char *name)
 	struct dir_info *dir;
 	char *path;
 
+	assert(parent);
+
 	path = dir_path(parent, name);
 	if (mkdir(path, 0777) != 0) {
 		if (errno == ENOSPC) {
@@ -469,8 +471,7 @@  static int dir_new(struct dir_info *parent, const char *name)
 	free(path);
 
 	dir = zalloc(sizeof(struct dir_info));
-	if (parent)
-		add_dir_entry(parent, 'd', name, dir);
+	add_dir_entry(parent, 'd', name, dir);
 	return 0;
 }