Changeset: 3f59599c85af for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/3f59599c85af Added Files: clients/mapilib/msettings_internal.h Modified Files: clients/mapilib/CMakeLists.txt clients/mapilib/msettings.c clients/mapilib/parseurl.c Branch: odbc_loader Log Message:
Introduce msettings_internal.h To share information between msettings.c and parseurl.c diffs (193 lines): diff --git a/clients/mapilib/CMakeLists.txt b/clients/mapilib/CMakeLists.txt --- a/clients/mapilib/CMakeLists.txt +++ b/clients/mapilib/CMakeLists.txt @@ -26,6 +26,7 @@ target_sources(mapi mapi.c connect.c msettings.c + msettings_internal.h parseurl.c $<$<BOOL:${HAVE_SYS_UN_H}>:connect_unix.c> $<$<BOOL:${OPENSSL_FOUND}>:connect_openssl.c> diff --git a/clients/mapilib/msettings.c b/clients/mapilib/msettings.c --- a/clients/mapilib/msettings.c +++ b/clients/mapilib/msettings.c @@ -13,6 +13,7 @@ #include "monetdb_config.h" #include "msettings.h" +#include "msettings_internal.h" #include "mstring.h" #include <assert.h> @@ -28,7 +29,7 @@ #define FATAL() do { fprintf(stderr, "\n\n abort in msettings.c: %s\n\n", __func__); abort(); } while (0) -static const char * const MALLOC_FAILED = "malloc failed"; +const char * const MALLOC_FAILED = "malloc failed"; bool msettings_malloc_failed(msettings_error err) @@ -186,63 +187,6 @@ mparm_is_core(mparm parm) } } -struct string { - char *str; - bool must_free; -}; - -struct msettings { - // Must match EXACTLY the order of enum mparm - bool dummy_start_bool; - bool tls; - bool autocommit; - bool client_info; - bool dummy_end_bool; - - // Must match EXACTLY the order of enum mparm - long dummy_start_long; - long port; - long timezone; - long replysize; - long map_to_long_varchar; - long connect_timeout; - long reply_timeout; - long dummy_end_long; - - // Must match EXACTLY the order of enum mparm - struct string dummy_start_string; - struct string sock; - struct string sockdir; - struct string cert; - struct string clientkey; - struct string clientcert; - struct string host; - struct string database; - struct string tableschema; - struct string table; - struct string certhash; - struct string user; - struct string password; - struct string language; - struct string schema; - struct string binary; - struct string logfile; - struct string client_application; - struct string client_remark; - struct string dummy_end_string; - - bool lang_is_mal; - bool lang_is_sql; - long user_generation; - long password_generation; - char *unix_sock_name_buffer; - char certhash_digits_buffer[64 + 2 + 1]; // fit more than required plus trailing '\0' - bool validated; - const char* (*localizer)(const void *data, mparm parm); - void *localizer_data; - char error_message[256]; -}; - static const msettings msettings_default_values = { .tls = false, diff --git a/clients/mapilib/msettings_internal.h b/clients/mapilib/msettings_internal.h new file mode 100644 --- /dev/null +++ b/clients/mapilib/msettings_internal.h @@ -0,0 +1,82 @@ +/* + * SPDX-License-Identifier: MPL-2.0 + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * Copyright 2024, 2025 MonetDB Foundation; + * Copyright August 2008 - 2023 MonetDB B.V.; + * Copyright 1997 - July 2008 CWI. + */ + +#ifndef MSETTINGS_INTERNAL +#define MSETTINGS_INTERNAL + +#include "msettings.h" + +extern const char * const MALLOC_FAILED; + + +struct string { + char *str; + bool must_free; +}; + +struct msettings { + // Must match EXACTLY the order of enum mparm + bool dummy_start_bool; + bool tls; + bool autocommit; + bool client_info; + bool dummy_end_bool; + + // Must match EXACTLY the order of enum mparm + long dummy_start_long; + long port; + long timezone; + long replysize; + long map_to_long_varchar; + long connect_timeout; + long reply_timeout; + long dummy_end_long; + + // Must match EXACTLY the order of enum mparm + struct string dummy_start_string; + struct string sock; + struct string sockdir; + struct string cert; + struct string clientkey; + struct string clientcert; + struct string host; + struct string database; + struct string tableschema; + struct string table; + struct string certhash; + struct string user; + struct string password; + struct string language; + struct string schema; + struct string binary; + struct string logfile; + struct string client_application; + struct string client_remark; + struct string dummy_end_string; + + bool lang_is_mal; + bool lang_is_sql; + long user_generation; + long password_generation; + char *unix_sock_name_buffer; + char certhash_digits_buffer[64 + 2 + 1]; // fit more than required plus trailing '\0' + bool validated; + const char* (*localizer)(const void *data, mparm parm); + void *localizer_data; + char error_message[256]; +}; + + + + + +#endif diff --git a/clients/mapilib/parseurl.c b/clients/mapilib/parseurl.c --- a/clients/mapilib/parseurl.c +++ b/clients/mapilib/parseurl.c @@ -13,6 +13,7 @@ #include "monetdb_config.h" #include "msettings.h" +#include "msettings_internal.h" #include <assert.h> #include <ctype.h> _______________________________________________ checkin-list mailing list -- checkin-list@monetdb.org To unsubscribe send an email to checkin-list-le...@monetdb.org