lib: remove vty->index

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
This commit is contained in:
David Lamparter 2016-12-07 17:30:16 +01:00
parent 52c6b0e20a
commit a50b7cebd5
9 changed files with 11 additions and 40 deletions

View File

@ -1,7 +1,6 @@
## Process this file with automake to produce Makefile.in.
AM_CPPFLAGS = -I.. -I$(top_srcdir) -I$(top_srcdir)/lib -I$(top_builddir)/lib \
-DVTY_DEPRECATE_INDEX
AM_CPPFLAGS = -I.. -I$(top_srcdir) -I$(top_srcdir)/lib -I$(top_builddir)/lib
DEFS = @DEFS@ -DSYSCONFDIR=\"$(sysconfdir)/\"
INSTALL_SDATA=@INSTALL@ -m 600
LIBS = @LIBS@

View File

@ -1,7 +1,6 @@
## Process this file with automake to produce Makefile.in.
AM_CPPFLAGS = -I.. -I$(top_srcdir) -I$(top_srcdir)/lib -I$(top_builddir)/lib \
-DVTY_DEPRECATE_INDEX
AM_CPPFLAGS = -I.. -I$(top_srcdir) -I$(top_srcdir)/lib -I$(top_builddir)/lib
DEFS = @DEFS@ -DSYSCONFDIR=\"$(sysconfdir)/\"
INSTALL_SDATA=@INSTALL@ -m 600

View File

@ -1,7 +1,6 @@
## Process this file with automake to produce Makefile.in.
AM_CPPFLAGS = -I.. -I$(top_srcdir) -I$(top_srcdir)/lib -I$(top_builddir)/lib \
-DVTY_DEPRECATE_INDEX
AM_CPPFLAGS = -I.. -I$(top_srcdir) -I$(top_srcdir)/lib -I$(top_builddir)/lib
AM_CFLAGS = $(WERROR)
DEFS = @DEFS@ -DSYSCONFDIR=\"$(sysconfdir)/\"
AM_YFLAGS = -d

View File

@ -784,7 +784,7 @@ DEFUN (interface,
vty_out (vty, "%% interface %s not in %s%s", ifname, vrfname, VTY_NEWLINE);
return CMD_WARNING;
}
VTY_PUSH_CONTEXT_COMPAT (INTERFACE_NODE, ifp);
VTY_PUSH_CONTEXT (INTERFACE_NODE, ifp);
return CMD_SUCCESS;
}

View File

@ -251,7 +251,7 @@ DEFUN (key_chain,
struct keychain *keychain;
keychain = keychain_get (argv[idx_word]->arg);
VTY_PUSH_CONTEXT_COMPAT (KEYCHAIN_NODE, keychain);
VTY_PUSH_CONTEXT (KEYCHAIN_NODE, keychain);
return CMD_SUCCESS;
}

View File

@ -2549,7 +2549,7 @@ DEFUN (route_map,
map = route_map_get (mapname);
index = route_map_index_get (map, permit, pref);
VTY_PUSH_CONTEXT_COMPAT (RMAP_NODE, index);
VTY_PUSH_CONTEXT (RMAP_NODE, index);
return CMD_SUCCESS;
}

View File

@ -494,7 +494,7 @@ DEFUN (vrf,
vrfp = vrf_get (VRF_UNKNOWN, vrfname);
VTY_PUSH_CONTEXT_COMPAT (VRF_NODE, vrfp);
VTY_PUSH_CONTEXT (VRF_NODE, vrfp);
return CMD_SUCCESS;
}

View File

@ -29,14 +29,6 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
#define VTY_BUFSIZ 512
#define VTY_MAXHIST 20
#if defined(VTY_DEPRECATE_INDEX) && defined(__GNUC__) && \
(__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) && \
!defined(__ICC)
#define INDEX_WARNING __attribute__((deprecated))
#else
#define INDEX_WARNING
#endif
/* VTY struct. */
struct vty
{
@ -82,10 +74,6 @@ struct vty
/* History insert end point */
int hindex;
/* For current referencing point of interface, route-map,
access-list etc... */
void *index INDEX_WARNING;
/* qobj object ID (replacement for "index") */
uint64_t qobj_index;
@ -139,32 +127,19 @@ struct vty
char address[SU_ADDRSTRLEN];
};
#undef INDEX_WARNING
static inline void vty_push_context(struct vty *vty,
int node, uint64_t id, void *idx)
int node, uint64_t id)
{
vty->node = node;
vty->qobj_index = id;
#if defined(VTY_DEPRECATE_INDEX) && defined(__GNUC__) && \
(__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6))
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
vty->index = idx;
#pragma GCC diagnostic pop
#else
vty->index = idx;
#endif
}
/* note: VTY_PUSH_CONTEXT(..., NULL) doesn't work, since it will try to
* dereference "NULL->qobj_node.nid" */
#define VTY_PUSH_CONTEXT(nodeval, ptr) \
vty_push_context(vty, nodeval, QOBJ_ID_0SAFE(ptr), NULL)
vty_push_context(vty, nodeval, QOBJ_ID_0SAFE(ptr))
#define VTY_PUSH_CONTEXT_NULL(nodeval) \
vty_push_context(vty, nodeval, 0ULL, NULL)
#define VTY_PUSH_CONTEXT_COMPAT(nodeval, ptr) \
vty_push_context(vty, nodeval, QOBJ_ID_0SAFE(ptr), ptr)
vty_push_context(vty, nodeval, 0ULL)
#define VTY_PUSH_CONTEXT_SUB(nodeval, ptr) do { \
vty->node = nodeval; \
/* qobj_index stays untouched */ \

View File

@ -2,8 +2,7 @@ include ../common.am
## Process this file with automake to produce Makefile.in.
AM_CPPFLAGS = -I.. -I$(top_srcdir) -I$(top_srcdir)/lib -I$(top_builddir)/lib \
-DVTY_DEPRECATE_INDEX
AM_CPPFLAGS = -I.. -I$(top_srcdir) -I$(top_srcdir)/lib -I$(top_builddir)/lib
DEFS = @DEFS@ -DSYSCONFDIR=\"$(sysconfdir)/\"
INSTALL_SDATA=@INSTALL@ -m 600