[PATCH] libosmocore[master]: vty: Fix bad use of vector_slot()

Pau Espin Pedrol gerrit-no-reply at lists.osmocom.org
Mon Oct 23 17:25:53 UTC 2017


Review at  https://gerrit.osmocom.org/4389

vty: Fix bad use of vector_slot()

Fixes the compilation warning below:

git/libosmocore/src/vty/command.c: In function ‘cmd_complete_command_real’:
git/libosmocore/src/vty/command.c:1953:33: warning: comparison between pointer and zero character const
ant [-Wpointer-compare]
   if (vector_slot(vline, index) == '\0')
                                 ^~
git/libosmocore/src/vty/command.c:37:0:
git/libosmocore/include/osmocom/vty/vector.h:39:27: note: did you mean to dereference the pointer?
 #define vector_slot(V,I)  ((V)->index[(I)])
                           ^
git/libosmocore/src/vty/command.c:1953:7: note: in expansion of macro ‘vector_slot’
   if (vector_slot(vline, index) == '\0')
       ^~~~~~~~~~~

Change-Id: Iaba9e3450d68c51e16a7bda2fc0fc370992ca866
---
M src/vty/command.c
1 file changed, 1 insertion(+), 1 deletion(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/89/4389/1

diff --git a/src/vty/command.c b/src/vty/command.c
index 21b26b4..355fb5d 100644
--- a/src/vty/command.c
+++ b/src/vty/command.c
@@ -1950,7 +1950,7 @@
 
 		/* In case of 'command \t' pattern.  Do you need '?' command at
 		   the end of the line. */
-		if (vector_slot(vline, index) == '\0')
+		if (*(char *)vector_slot(vline, index) == '\0')
 			*status = CMD_ERR_NOTHING_TODO;
 		else
 			*status = CMD_ERR_NO_MATCH;

-- 
To view, visit https://gerrit.osmocom.org/4389
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iaba9e3450d68c51e16a7bda2fc0fc370992ca866
Gerrit-PatchSet: 1
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Pau Espin Pedrol <pespin at sysmocom.de>


More information about the gerrit-log mailing list