Changeset: a6ffd8d79acc for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=a6ffd8d79acc
Modified Files:
        clients/mapilib/mapi.c
Branch: default
Log Message:

Modernize: use __func__.


diffs (truncated from 536 to 300 lines):

diff --git a/clients/mapilib/mapi.c b/clients/mapilib/mapi.c
--- a/clients/mapilib/mapi.c
+++ b/clients/mapilib/mapi.c
@@ -891,44 +891,48 @@ struct MapiStatement {
  * routine. It assures a working connection and proper reset of
  * the error status of the Mapi structure.
  */
-#define mapi_check(X,C)                                                        
\
+#define mapi_check(X)                                                  \
        do {                                                            \
-               debugprint("entering %s\n", (C));                       \
+               debugprint("entering %s\n", __func__);                  \
                assert(X);                                              \
                if (!(X)->connected) {                                  \
-                       mapi_setError((X), "Connection lost", (C), MERROR); \
+                       mapi_setError((X), "Connection lost",           \
+                                     __func__, MERROR);                \
                        return (X)->error;                              \
                }                                                       \
                mapi_clrError(X);                                       \
        } while (0)
-#define mapi_check0(X,C)                                               \
+#define mapi_check0(X)                                                 \
        do {                                                            \
-               debugprint("entering %s\n", (C));                       \
+               debugprint("entering %s\n", __func__);                  \
                assert(X);                                              \
                if (!(X)->connected) {                                  \
-                       mapi_setError((X), "Connection lost", (C), MERROR); \
+                       mapi_setError((X), "Connection lost",           \
+                                     __func__, MERROR);                \
                        return 0;                                       \
                }                                                       \
                mapi_clrError(X);                                       \
        } while (0)
-#define mapi_hdl_check(X,C)                                            \
+#define mapi_hdl_check(X)                                              \
        do {                                                            \
-               debugprint("entering %s\n", (C));                       \
+               debugprint("entering %s\n", __func__);                  \
                assert(X);                                              \
                assert((X)->mid);                                       \
                if (!(X)->mid->connected) {                             \
-                       mapi_setError((X)->mid, "Connection lost", (C), 
MERROR); \
+                       mapi_setError((X)->mid, "Connection lost",      \
+                                     __func__, MERROR);                \
                        return (X)->mid->error;                         \
                }                                                       \
                mapi_clrError((X)->mid);                                \
        } while (0)
-#define mapi_hdl_check0(X,C)                                           \
+#define mapi_hdl_check0(X)                                             \
        do {                                                            \
-               debugprint("entering %s\n", (C));                       \
+               debugprint("entering %s\n", __func__);                  \
                assert(X);                                              \
                assert((X)->mid);                                       \
                if (!(X)->mid->connected) {                             \
-                       mapi_setError((X)->mid, "Connection lost", (C), 
MERROR); \
+                       mapi_setError((X)->mid, "Connection lost",      \
+                                     __func__, MERROR);                \
                        return 0;                                       \
                }                                                       \
                mapi_clrError((X)->mid);                                \
@@ -1279,28 +1283,28 @@ mapi_explain_result(MapiHdl hdl, FILE *f
 stream *
 mapi_get_to(Mapi mid)
 {
-       mapi_check0(mid, "mapi_get_to");
+       mapi_check0(mid);
        return mid->to;
 }
 
 stream *
 mapi_get_from(Mapi mid)
 {
-       mapi_check0(mid, "mapi_get_from");
+       mapi_check0(mid);
        return mid->from;
 }
 
 bool
 mapi_get_trace(Mapi mid)
 {
-       mapi_check0(mid, "mapi_get_trace");
+       mapi_check0(mid);
        return mid->trace;
 }
 
 bool
 mapi_get_autocommit(Mapi mid)
 {
-       mapi_check0(mid, "mapi_get_autocommit");
+       mapi_check0(mid);
        return mid->auto_commit;
 }
 
@@ -1373,7 +1377,7 @@ mapi_ping(Mapi mid)
 {
        MapiHdl hdl = NULL;
 
-       mapi_check(mid, "mapi_ping");
+       mapi_check(mid);
        switch (mid->languageId) {
        case LANG_SQL:
                hdl = mapi_query(mid, "select true;");
@@ -1621,7 +1625,7 @@ mapi_result_errorcode(MapiHdl hdl)
 MapiMsg
 mapi_next_result(MapiHdl hdl)
 {
-       mapi_hdl_check(hdl, "mapi_next_result");
+       mapi_hdl_check(hdl);
 
        while (hdl->result != NULL) {
                if (close_result(hdl) != MOK)
@@ -1648,7 +1652,7 @@ mapi_more_results(MapiHdl hdl)
 {
        struct MapiResultSet *result;
 
-       mapi_hdl_check(hdl, "mapi_more_results");
+       mapi_hdl_check(hdl);
 
        if ((result = hdl->result) == 0) {
                /* there are no results at all */
@@ -1681,7 +1685,7 @@ mapi_new_handle(Mapi mid)
 {
        MapiHdl hdl;
 
-       mapi_check0(mid, "mapi_new_handle");
+       mapi_check0(mid);
 
        hdl = malloc(sizeof(*hdl));
        if (hdl == NULL) {
@@ -3000,7 +3004,7 @@ close_connection(Mapi mid)
 MapiMsg
 mapi_disconnect(Mapi mid)
 {
-       mapi_check(mid, "mapi_disconnect");
+       mapi_check(mid);
 
        close_connection(mid);
        return MOK;
@@ -3008,7 +3012,7 @@ mapi_disconnect(Mapi mid)
 
 #define testBinding(hdl,fnr,funcname)                                  \
        do {                                                            \
-               mapi_hdl_check(hdl, funcname);                          \
+               mapi_hdl_check(hdl);                            \
                if (fnr < 0) {                                          \
                        return mapi_setError(hdl->mid,                  \
                                             "Illegal field number",    \
@@ -3021,7 +3025,7 @@ mapi_disconnect(Mapi mid)
 
 #define testParam(hdl, fnr, funcname)                                  \
        do {                                                            \
-               mapi_hdl_check(hdl, funcname);                          \
+               mapi_hdl_check(hdl);                            \
                if (fnr < 0) {                                          \
                        return mapi_setError(hdl->mid,                  \
                                             "Illegal param number",    \
@@ -3068,7 +3072,7 @@ mapi_bind_numeric(MapiHdl hdl, int fnr, 
 MapiMsg
 mapi_clear_bindings(MapiHdl hdl)
 {
-       mapi_hdl_check(hdl, "mapi_clear_bindings");
+       mapi_hdl_check(hdl);
        if (hdl->bindings)
                memset(hdl->bindings, 0, hdl->maxbindings * 
sizeof(*hdl->bindings));
        return MOK;
@@ -3125,7 +3129,7 @@ mapi_param_numeric(MapiHdl hdl, int fnr,
 MapiMsg
 mapi_clear_params(MapiHdl hdl)
 {
-       mapi_hdl_check(hdl, "mapi_clear_params");
+       mapi_hdl_check(hdl);
        if (hdl->params)
                memset(hdl->params, 0, hdl->maxparams * sizeof(*hdl->params));
        return MOK;
@@ -3151,7 +3155,7 @@ prepareQuery(MapiHdl hdl, const char *cm
 MapiMsg
 mapi_timeout(Mapi mid, unsigned int timeout)
 {
-       mapi_check(mid, "mapi_timeout");
+       mapi_check(mid);
        if (mid->trace)
                printf("Set timeout to %u\n", timeout);
        mnstr_settimeout(mid->to, timeout, NULL);
@@ -3164,7 +3168,7 @@ mapi_Xcommand(Mapi mid, const char *cmdn
 {
        MapiHdl hdl;
 
-       mapi_check(mid, "mapi_Xcommand");
+       mapi_check(mid);
        if (mid->active && read_into_cache(mid->active, 0) != MOK)
                return MERROR;
        if (mnstr_printf(mid->to, "X" "%s %s\n", cmdname, cmdvalue) < 0 ||
@@ -3190,7 +3194,7 @@ mapi_Xcommand(Mapi mid, const char *cmdn
 MapiMsg
 mapi_prepare_handle(MapiHdl hdl, const char *cmd)
 {
-       mapi_hdl_check(hdl, "mapi_prepare_handle");
+       mapi_hdl_check(hdl);
        if (finish_handle(hdl) != MOK)
                return MERROR;
        prepareQuery(hdl, cmd);
@@ -3204,7 +3208,7 @@ mapi_prepare(Mapi mid, const char *cmd)
 {
        MapiHdl hdl;
 
-       mapi_check0(mid, "mapi_prepare");
+       mapi_check0(mid);
        hdl = mapi_new_handle(mid);
        if (hdl == NULL)
                return NULL;
@@ -4050,7 +4054,7 @@ mapi_execute(MapiHdl hdl)
 {
        int ret;
 
-       mapi_hdl_check(hdl, "mapi_execute");
+       mapi_hdl_check(hdl);
        if ((ret = mapi_execute_internal(hdl)) == MOK)
                return read_into_cache(hdl, 1);
 
@@ -4070,7 +4074,7 @@ mapi_query(Mapi mid, const char *cmd)
        int ret;
        MapiHdl hdl;
 
-       mapi_check0(mid, "mapi_query");
+       mapi_check0(mid);
        hdl = prepareQuery(mapi_new_handle(mid), cmd);
        ret = mid->error;
        if (ret == MOK)
@@ -4087,7 +4091,7 @@ mapi_send(Mapi mid, const char *cmd)
        int ret;
        MapiHdl hdl;
 
-       mapi_check0(mid, "mapi_send");
+       mapi_check0(mid);
        hdl = prepareQuery(mapi_new_handle(mid), cmd);
        ret = mid->error;
        if (ret == MOK)
@@ -4106,7 +4110,7 @@ mapi_query_handle(MapiHdl hdl, const cha
 {
        int ret;
 
-       mapi_hdl_check(hdl, "mapi_query_handle");
+       mapi_hdl_check(hdl);
        if (finish_handle(hdl) != MOK)
                return MERROR;
        prepareQuery(hdl, cmd);
@@ -4121,7 +4125,7 @@ mapi_query_handle(MapiHdl hdl, const cha
 MapiHdl
 mapi_query_prep(Mapi mid)
 {
-       mapi_check0(mid, "mapi_query_prep");
+       mapi_check0(mid);
        if (mid->active && read_into_cache(mid->active, 0) != MOK)
                return NULL;
        assert(mid->active == NULL);
@@ -4142,7 +4146,7 @@ mapi_query_part(MapiHdl hdl, const char 
 {
        Mapi mid;
 
-       mapi_hdl_check(hdl, "mapi_query_part");
+       mapi_hdl_check(hdl);
        mid = hdl->mid;
        assert(mid->active == NULL || mid->active == hdl);
        mid->active = hdl;
@@ -4184,7 +4188,7 @@ mapi_query_done(MapiHdl hdl)
        int ret;
        Mapi mid;
 
-       mapi_hdl_check(hdl, "mapi_query_done");
+       mapi_hdl_check(hdl);
        mid = hdl->mid;
        assert(mid->active == NULL || mid->active == hdl);
        mid->active = hdl;
@@ -4201,7 +4205,7 @@ MapiMsg
 mapi_cache_limit(Mapi mid, int limit)
 {
        /* clean out superflous space TODO */
-       mapi_check(mid, "mapi_cache_limit");
+       mapi_check(mid);
        mid->cachelimit = limit;
 /*     if (hdl->cache.rowlimit < hdl->cache.limit) { */
        /* TODO: decide what to do here */
@@ -4242,7 +4246,7 @@ mapi_cache_limit(Mapi mid, int limit)
 MapiMsg
 mapi_fetch_reset(MapiHdl hdl)
 {
-       mapi_hdl_check(hdl, "mapi_fetch_reset");
+       mapi_hdl_check(hdl);
        if (hdl->result)
                hdl->result->cache.reader = -1;
        return MOK;
@@ -4253,7 +4257,7 @@ mapi_seek_row(MapiHdl hdl, int64_t rownr
 {
        struct MapiResultSet *result;
 
-       mapi_hdl_check(hdl, "mapi_seek_row");
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to