[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[Nbd] [PATCH 1/1] server: remove non-reachable call to err()



Currently, all places where append_serve() is called from, ensure that
the server argument is never NULL.

Furthermore,

- exiting on error inside a "util" function is bad practice, it makes it
  almost impossible to use the function from other code paths

- appending NULL server does not make any sense, therefore checking for
  NULL is pointless, it's a programmer error to call append_serve() with
  NULL

Signed-off-by: Tuomas Räsänen <tuomasjjrasanen@...1261...>
---
 nbd-server.c |    3 ---
 1 file changed, 3 deletions(-)

diff --git a/nbd-server.c b/nbd-server.c
index 27c4600..554c423 100644
--- a/nbd-server.c
+++ b/nbd-server.c
@@ -710,9 +710,6 @@ int append_serve(const SERVER *const s, GArray *const a) {
 	int e;
 	int ret;
 
-	if(!s)
-		err("Invalid parsing server");
-
 	port = g_strdup_printf("%d", s->port);
 
 	memset(&hints,'\0',sizeof(hints));
-- 
1.7.10.4




Reply to: