Changeset: 6a0efad4e427 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/6a0efad4e427
Modified Files:
.editorconfig
clients/mapiclient/dump.c
common/options/monet_options.c
common/options/monet_options.h
common/utils/copybinary.h
common/utils/copybinary_support.h
common/utils/mcrypt.c
common/utils/mcrypt.h
common/utils/msabaoth.c
common/utils/mstring.h
common/utils/mutf8.c
common/utils/mutf8.h
common/utils/mutils.c
common/utils/muuid.c
common/utils/revision.c
Branch: default
Log Message:
Use 8-space tabs in common/utils and common/options.
diffs (truncated from 905 to 300 lines):
diff --git a/.editorconfig b/.editorconfig
--- a/.editorconfig
+++ b/.editorconfig
@@ -24,7 +24,7 @@ indent_style = space
indent_size = 2
trim_trailing_whitespace = true
-[{clients/{mapi{lib,client},odbc},gdk}/**.{c,h}{,.in}]
+[{clients/{mapi{lib,client},odbc},common/{options,utils},gdk}/**.{c,h}{,.in}]
tab_width = 8
max_line_length = 72
diff --git a/clients/mapiclient/dump.c b/clients/mapiclient/dump.c
--- a/clients/mapiclient/dump.c
+++ b/clients/mapiclient/dump.c
@@ -11,7 +11,6 @@
#include "monetdb_config.h"
#include "mapi.h"
#include "stream.h"
-#include "mstring.h"
#include <unistd.h>
#include <string.h>
#include <ctype.h>
diff --git a/common/options/monet_options.c b/common/options/monet_options.c
--- a/common/options/monet_options.c
+++ b/common/options/monet_options.c
@@ -43,7 +43,8 @@ mo_default_set(opt **Set, int setlen)
if (*Set == NULL) {
if (default_set == NULL) {
default_setlen = mo_builtin_settings(&default_set);
- default_setlen = mo_system_config(&default_set,
default_setlen);
+ default_setlen = mo_system_config(&default_set,
+ default_setlen);
}
*Set = default_set;
setlen = default_setlen;
@@ -59,17 +60,20 @@ mo_print_options(opt *set, int setlen)
setlen = mo_default_set(&set, setlen);
for (i = 0; i < setlen; i++) {
if (set[i].kind == opt_builtin) {
- fprintf(stderr, "# builtin opt \t%s = %s\n",
set[i].name, set[i].value);
+ fprintf(stderr, "# builtin opt \t%s = %s\n",
+ set[i].name, set[i].value);
}
}
for (i = 0; i < setlen; i++) {
if (set[i].kind == opt_config) {
- fprintf(stderr, "# config opt \t%s = %s\n",
set[i].name, set[i].value);
+ fprintf(stderr, "# config opt \t%s = %s\n",
+ set[i].name, set[i].value);
}
}
for (i = 0; i < setlen; i++) {
if (set[i].kind == opt_cmdline) {
- fprintf(stderr, "# cmdline opt \t%s = %s\n",
set[i].name, set[i].value);
+ fprintf(stderr, "# cmdline opt \t%s = %s\n",
+ set[i].name, set[i].value);
}
}
}
@@ -126,7 +130,9 @@ mo_config_file(opt **Set, int setlen, co
val = strchr(s, '=');
if (val == NULL) {
- fprintf(stderr, "mo_config_file: syntax error in %s at
%s\n", file, s);
+ fprintf(stderr,
+ "mo_config_file: syntax error in %s at %s\n",
+ file, s);
break;
}
*val = 0;
@@ -148,7 +154,9 @@ mo_config_file(opt **Set, int setlen, co
break;
}
if (quote) {
- fprintf(stderr, "mo_config_file: wrong number of quotes
in %s at %s\n", file, val);
+ fprintf(stderr,
+ "mo_config_file: wrong number of quotes in %s
at %s\n",
+ file, val);
break;
}
/* remove trailing white space */
@@ -270,7 +278,8 @@ mo_builtin_settings(opt **Set)
}
int
-mo_add_option(opt **Set, int setlen, opt_kind kind, const char *name, const
char *value)
+mo_add_option(opt **Set, int setlen, opt_kind kind,
+ const char *name, const char *value)
{
opt *set;
diff --git a/common/options/monet_options.h b/common/options/monet_options.h
--- a/common/options/monet_options.h
+++ b/common/options/monet_options.h
@@ -36,7 +36,8 @@ moptions_export void mo_print_options(op
/* mo_find_option, finds the option with the given name in the option set
(set,setlen). */
-moptions_export const char *mo_find_option(opt *set, int setlen, const char
*name);
+moptions_export const char *mo_find_option(opt *set, int setlen,
+ const char *name);
/* mo_system_config will add the options from the system config file
(returns the new setlen) */
@@ -48,7 +49,8 @@ moptions_export int mo_builtin_settings(
/* mo_add_option will add a single option to the option set
(returns new length) */
-moptions_export int mo_add_option(opt **Set, int setlen, opt_kind kind, const
char *name, const char *value);
+moptions_export int mo_add_option(opt **Set, int setlen, opt_kind kind,
+ const char *name, const char *value);
/* mo_free_options will free the resources take by the options set */
moptions_export void mo_free_options(opt *set, int setlen);
diff --git a/common/utils/copybinary.h b/common/utils/copybinary.h
--- a/common/utils/copybinary.h
+++ b/common/utils/copybinary.h
@@ -11,6 +11,8 @@
#ifndef COPYBINARY_H
#define COPYBINARY_H
+#include <stdint.h>
+
typedef struct {
uint8_t day;
uint8_t month;
diff --git a/common/utils/copybinary_support.h
b/common/utils/copybinary_support.h
--- a/common/utils/copybinary_support.h
+++ b/common/utils/copybinary_support.h
@@ -11,6 +11,7 @@
#ifndef COPYBINARY_SUPPORT_H
#define COPYBINARY_SUPPORT_H
+#include <stdint.h>
#include "copybinary.h"
// According to Godbolt, these code sequences are recognized by
@@ -27,64 +28,83 @@
#ifdef _MSC_VER
static inline uint16_t
-copy_binary_byteswap16(uint16_t value) {
+copy_binary_byteswap16(uint16_t value)
+{
return _byteswap_ushort(value);
}
static inline uint32_t
-copy_binary_byteswap32(uint32_t value) {
+copy_binary_byteswap32(uint32_t value)
+{
return _byteswap_ulong(value);
}
static inline uint64_t
-copy_binary_byteswap64(uint64_t value) {
+copy_binary_byteswap64(uint64_t value)
+{
return _byteswap_uint64(value);
}
#else
static inline uint16_t
-copy_binary_byteswap16(uint16_t value) {
+copy_binary_byteswap16(uint16_t value)
+{
return
- ((value & 0xFF00u) >> 8u) |
- ((value & 0x00FFu) << 8u)
+ ((value & (UINT16_C(0xFF) << 8)) >> 8) |
+ ((value & (UINT16_C(0xFF) << 0)) << 8)
;
}
static inline uint32_t
-copy_binary_byteswap32(uint32_t value) {
+copy_binary_byteswap32(uint32_t value)
+{
return
- ((value & 0xFF000000u) >> 24u) |
- ((value & 0x00FF0000u) >> 8u) |
- ((value & 0x0000FF00u) << 8u) |
- ((value & 0x000000FFu) << 24u)
+ ((value & (UINT32_C(0xFF) << 24)) >> 24) |
+ ((value & (UINT32_C(0xFF) << 16)) >> 8) |
+ ((value & (UINT32_C(0xFF) << 8)) << 8) |
+ ((value & (UINT32_C(0xFF) << 0)) << 24)
;
}
static inline uint64_t
-copy_binary_byteswap64(uint64_t value) {
+copy_binary_byteswap64(uint64_t value)
+{
return
- ((value & 0xFF00000000000000u) >> 56u) |
- ((value & 0x00FF000000000000u) >> 40u) |
- ((value & 0x0000FF0000000000u) >> 24u) |
- ((value & 0x000000FF00000000u) >> 8u) |
- ((value & 0x00000000FF000000u) << 8u) |
- ((value & 0x0000000000FF0000u) << 24u) |
- ((value & 0x000000000000FF00u) << 40u) |
- ((value & 0x00000000000000FFu) << 56u)
+ ((value & (UINT64_C(0xFF) << 56)) >> 56) |
+ ((value & (UINT64_C(0xFF) << 48)) >> 40) |
+ ((value & (UINT64_C(0xFF) << 40)) >> 24) |
+ ((value & (UINT64_C(0xFF) << 32)) >> 8) |
+ ((value & (UINT64_C(0xFF) << 24)) << 8) |
+ ((value & (UINT64_C(0xFF) << 16)) << 24) |
+ ((value & (UINT64_C(0xFF) << 8)) << 40) |
+ ((value & (UINT64_C(0xFF) << 0)) << 56)
;
}
#endif
#ifdef HAVE_HGE
-static inline
-uint128_t copy_binary_byteswap128(uint128_t value) {
- uint64_t lo = (uint64_t) value;
- uint64_t hi = (uint64_t) (value >> 64);
- uint128_t swapped_lo = (uint128_t)copy_binary_byteswap64(lo);
- uint128_t swapped_hi = (uint128_t)copy_binary_byteswap64(hi);
- return swapped_hi | (swapped_lo << 64);
+static inline uint128_t
+copy_binary_byteswap128(uint128_t value)
+{
+ return
+ ((value & ((uint128_t) 0xFF << 120)) >> 120) |
+ ((value & ((uint128_t) 0xFF << 112)) >> 104) |
+ ((value & ((uint128_t) 0xFF << 104)) >> 88) |
+ ((value & ((uint128_t) 0xFF << 96)) >> 72) |
+ ((value & ((uint128_t) 0xFF << 88)) >> 56) |
+ ((value & ((uint128_t) 0xFF << 80)) >> 40) |
+ ((value & ((uint128_t) 0xFF << 72)) >> 24) |
+ ((value & ((uint128_t) 0xFF << 64)) >> 8) |
+ ((value & ((uint128_t) 0xFF << 56)) << 8) |
+ ((value & ((uint128_t) 0xFF << 48)) << 24) |
+ ((value & ((uint128_t) 0xFF << 40)) << 40) |
+ ((value & ((uint128_t) 0xFF << 32)) << 56) |
+ ((value & ((uint128_t) 0xFF << 24)) << 72) |
+ ((value & ((uint128_t) 0xFF << 16)) << 88) |
+ ((value & ((uint128_t) 0xFF << 8)) << 104) |
+ ((value & ((uint128_t) 0xFF << 0)) << 120);
}
#endif
diff --git a/common/utils/mcrypt.c b/common/utils/mcrypt.c
--- a/common/utils/mcrypt.c
+++ b/common/utils/mcrypt.c
@@ -306,9 +306,9 @@ mcrypt_BackendSum(const char *string, si
*/
char *
mcrypt_hashPassword(
- const char *algo,
- const char *password,
- const char *challenge)
+ const char *algo,
+ const char *password,
+ const char *challenge)
{
unsigned char md[64]; /* should be SHA512_DIGEST_LENGTH */
char ret[sizeof(md) * 2 + 1];
@@ -386,29 +386,29 @@ mcrypt_hashPassword(
}
snprintf(ret, sizeof(ret),
- "%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x"
- "%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x"
- "%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x"
- "%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x"
- "%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x"
- "%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x"
- "%02x%02x%02x%02x",
- md[0], md[1], md[2], md[3],
- md[4], md[5], md[6], md[7],
- md[8], md[9], md[10], md[11],
- md[12], md[13], md[14], md[15],
- md[16], md[17], md[18], md[19],
- md[20], md[21], md[22], md[23],
- md[24], md[25], md[26], md[27],
- md[28], md[29], md[30], md[31],
- md[32], md[33], md[34], md[35],
- md[36], md[37], md[38], md[39],
- md[40], md[41], md[42], md[43],
- md[44], md[45], md[46], md[47],
- md[48], md[49], md[50], md[51],
- md[52], md[53], md[54], md[55],
- md[56], md[57], md[58], md[59],
- md[60], md[61], md[62], md[63]);
+ "%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x"
+ "%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x"
+ "%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x"
+ "%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x"
+ "%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x"
+ "%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x"
+ "%02x%02x%02x%02x",
+ md[0], md[1], md[2], md[3],
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]