Message ID | 1587506945-7285-1-git-send-email-yihung.wei@gmail.com |
---|---|
State | Accepted |
Commit | ffc0c87393012402e4647c07cc848f68aee7faf9 |
Headers | show |
Series | [ovs-dev] ovsdb: Remove duplicated function defintions | expand |
On Tue, Apr 21, 2020 at 3:24 PM Yi-Hung Wei <yihung.wei@gmail.com> wrote: > > ovsdb_function_from_string() and ovsdb_function_to_string() are defined > both in ovsdb/condition.c and lib/ovsdb-condidtion.c with the same function > definition. Remove the one in ovsdb/condition.c to avoid duplication. > > This also resolves the following bazel building error. > > ./libopenvswitch.lo(ovsdb-condition.pic.o): In function `ovsdb_function_from_string': > /lib/ovsdb-condition.c:24: multiple definition of `ovsdb_function_from_string' > ./libovsdb.a(condition.pic.o):/proc/self/cwd/external/openvswitch_repo/ovsdb/condition.c:34: first defined here > ./libopenvswitch.lo(ovsdb-condition.pic.o): In function `ovsdb_function_from_string': > ./lib/ovsdb-condition.c:24: multiple definition of `ovsdb_function_to_string' > ./libovsdb.a(condition.pic.o):/proc/self/cwd/external/openvswitch_repo/ovsdb/condition.c:335 > > Reported-by: Harold Lim <haroldl@vmware.com> > Signed-off-by: Yi-Hung Wei <yihung.wei@gmail.com> > --- Thanks for the patch! I'm curious that why our current travis-ci doesn't get this error, but bazel finds it? Is there any compiler flags we need to enable? William > Travis-CI: https://travis-ci.org/github/YiHungWei/ovs/builds/677890120 > --- > ovsdb/condition.c | 27 --------------------------- > 1 file changed, 27 deletions(-) > > diff --git a/ovsdb/condition.c b/ovsdb/condition.c > index 692c0932864c..388dd54a16cf 100644 > --- a/ovsdb/condition.c > +++ b/ovsdb/condition.c > @@ -29,33 +29,6 @@ > #include "table.h" > #include "util.h" > > -struct ovsdb_error * > -ovsdb_function_from_string(const char *name, enum ovsdb_function *function) > -{ > -#define OVSDB_FUNCTION(ENUM, NAME) \ > - if (!strcmp(name, NAME)) { \ > - *function = ENUM; \ > - return NULL; \ > - } > - OVSDB_FUNCTIONS; > -#undef OVSDB_FUNCTION > - > - return ovsdb_syntax_error(NULL, "unknown function", > - "No function named %s.", name); > -} > - > -const char * > -ovsdb_function_to_string(enum ovsdb_function function) > -{ > - switch (function) { > -#define OVSDB_FUNCTION(ENUM, NAME) case ENUM: return NAME; > - OVSDB_FUNCTIONS; > -#undef OVSDB_FUNCTION > - } > - > - return NULL; > -} > - > static struct ovsdb_error * > ovsdb_clause_from_json(const struct ovsdb_table_schema *ts, > const struct json *json, > -- > 2.7.4 > > _______________________________________________ > dev mailing list > dev@openvswitch.org > https://mail.openvswitch.org/mailman/listinfo/ovs-dev
On Tue, Apr 21, 2020 at 03:09:05PM -0700, Yi-Hung Wei wrote: > ovsdb_function_from_string() and ovsdb_function_to_string() are defined > both in ovsdb/condition.c and lib/ovsdb-condidtion.c with the same function > definition. Remove the one in ovsdb/condition.c to avoid duplication. > > This also resolves the following bazel building error. > > ./libopenvswitch.lo(ovsdb-condition.pic.o): In function `ovsdb_function_from_string': > /lib/ovsdb-condition.c:24: multiple definition of `ovsdb_function_from_string' > ./libovsdb.a(condition.pic.o):/proc/self/cwd/external/openvswitch_repo/ovsdb/condition.c:34: first defined here > ./libopenvswitch.lo(ovsdb-condition.pic.o): In function `ovsdb_function_from_string': > ./lib/ovsdb-condition.c:24: multiple definition of `ovsdb_function_to_string' > ./libovsdb.a(condition.pic.o):/proc/self/cwd/external/openvswitch_repo/ovsdb/condition.c:335 > > Reported-by: Harold Lim <haroldl@vmware.com> > Signed-off-by: Yi-Hung Wei <yihung.wei@gmail.com> > --- > Travis-CI: https://travis-ci.org/github/YiHungWei/ovs/builds/677890120 Applied to master, thanks William
diff --git a/ovsdb/condition.c b/ovsdb/condition.c index 692c0932864c..388dd54a16cf 100644 --- a/ovsdb/condition.c +++ b/ovsdb/condition.c @@ -29,33 +29,6 @@ #include "table.h" #include "util.h" -struct ovsdb_error * -ovsdb_function_from_string(const char *name, enum ovsdb_function *function) -{ -#define OVSDB_FUNCTION(ENUM, NAME) \ - if (!strcmp(name, NAME)) { \ - *function = ENUM; \ - return NULL; \ - } - OVSDB_FUNCTIONS; -#undef OVSDB_FUNCTION - - return ovsdb_syntax_error(NULL, "unknown function", - "No function named %s.", name); -} - -const char * -ovsdb_function_to_string(enum ovsdb_function function) -{ - switch (function) { -#define OVSDB_FUNCTION(ENUM, NAME) case ENUM: return NAME; - OVSDB_FUNCTIONS; -#undef OVSDB_FUNCTION - } - - return NULL; -} - static struct ovsdb_error * ovsdb_clause_from_json(const struct ovsdb_table_schema *ts, const struct json *json,
ovsdb_function_from_string() and ovsdb_function_to_string() are defined both in ovsdb/condition.c and lib/ovsdb-condidtion.c with the same function definition. Remove the one in ovsdb/condition.c to avoid duplication. This also resolves the following bazel building error. ./libopenvswitch.lo(ovsdb-condition.pic.o): In function `ovsdb_function_from_string': /lib/ovsdb-condition.c:24: multiple definition of `ovsdb_function_from_string' ./libovsdb.a(condition.pic.o):/proc/self/cwd/external/openvswitch_repo/ovsdb/condition.c:34: first defined here ./libopenvswitch.lo(ovsdb-condition.pic.o): In function `ovsdb_function_from_string': ./lib/ovsdb-condition.c:24: multiple definition of `ovsdb_function_to_string' ./libovsdb.a(condition.pic.o):/proc/self/cwd/external/openvswitch_repo/ovsdb/condition.c:335 Reported-by: Harold Lim <haroldl@vmware.com> Signed-off-by: Yi-Hung Wei <yihung.wei@gmail.com> --- Travis-CI: https://travis-ci.org/github/YiHungWei/ovs/builds/677890120 --- ovsdb/condition.c | 27 --------------------------- 1 file changed, 27 deletions(-)