diff --git a/include/box/box.h b/include/box/box.h index 43808bc50fdaf47fee816d340103aec59dd4ee93..a9c291267121c58413d07bb7ade6979d332505a7 100644 --- a/include/box/box.h +++ b/include/box/box.h @@ -70,12 +70,14 @@ extern box_process_func box_process_ro; * Check storage-layer related options in the * configuration file. */ -i32 box_check_config(struct tarantool_cfg *conf); +int +box_check_config(struct tarantool_cfg *conf); /* * Take into effect storage-layer related * changes in the server configuration. */ -i32 box_reload_config(struct tarantool_cfg *old_conf, struct tarantool_cfg *new_conf); +int +box_reload_config(struct tarantool_cfg *old_conf, struct tarantool_cfg *new_conf); void box_lua_load_cfg(struct lua_State *L); /** * Iterate over all spaces and save them to the diff --git a/include/tarantool.h b/include/tarantool.h index f9589f2ffeb4bf9204d74e95f5f210aba6acbc08..017ae428814d05b6e5f71b3a52ad5fcb092b0b7c 100644 --- a/include/tarantool.h +++ b/include/tarantool.h @@ -45,7 +45,7 @@ extern char *cfg_filename_fullpath; extern bool init_storage, booting; extern char *binary_filename; extern char *custom_proc_title; -i32 reload_cfg(struct tbuf *out); +int reload_cfg(struct tbuf *out); void show_cfg(struct tbuf *out); int snapshot(void); const char *tarantool_version(void); diff --git a/include/tarantool/util.h b/include/tarantool/util.h index 8b656b3549775c861160b9c0a7dcfd79040b9640..22322dd3d2f7c43106e7f41a8b2807742f004545 100644 --- a/include/tarantool/util.h +++ b/include/tarantool/util.h @@ -122,7 +122,6 @@ strindex(const char **haystack, const char *needle, uint32_t hmax); #endif typedef uint32_t u32; -typedef int32_t i32; #define CRLF "\n" diff --git a/src/box/box.cc b/src/box/box.cc index 0c28e4f60868563849540ff706a5c26e477a8288..efa4e0342fb7e9290bb9b98709ad6449ca71c8d9 100644 --- a/src/box/box.cc +++ b/src/box/box.cc @@ -226,7 +226,7 @@ box_leave_local_standby_mode(void *data __attribute__((unused))) box_enter_master_or_replica_mode(&cfg); } -i32 +int box_check_config(struct tarantool_cfg *conf) { /* replication & hot standby modes can not work together */ @@ -286,7 +286,7 @@ box_check_config(struct tarantool_cfg *conf) return 0; } -i32 +int box_reload_config(struct tarantool_cfg *old_conf, struct tarantool_cfg *new_conf) { bool old_is_replica = old_conf->replication_source != NULL; diff --git a/src/box/tuple_update.cc b/src/box/tuple_update.cc index 0f4e0d37e65e088689c7392039edeadfdd81c3eb..c23f5a01f2a92d31221ee61e475fff7117f7fa8a 100644 --- a/src/box/tuple_update.cc +++ b/src/box/tuple_update.cc @@ -121,22 +121,22 @@ struct op_set_arg { struct op_arith_arg { u32 val_size; union { - i32 i32_val; + int32_t i32_val; int64_t i64_val; }; }; /** Argument of SPLICE. */ struct op_splice_arg { - i32 offset; /** splice position */ - i32 cut_length; /** cut this many bytes. */ + int32_t offset; /** splice position */ + int32_t cut_length; /** cut this many bytes. */ const char *paste; /** paste what? */ - i32 paste_length; /** paste this many bytes. */ + int32_t paste_length; /** paste this many bytes. */ /** Offset of the tail in the old field */ - i32 tail_offset; + int32_t tail_offset; /** Size of the tail. */ - i32 tail_length; + int32_t tail_length; }; union update_op_arg { @@ -233,8 +233,8 @@ do_update_op_set(struct op_set_arg *arg, const char *in __attribute__((unused)), static void do_update_op_add(struct op_arith_arg *arg, const char *in, char *out) { - if (arg->val_size == sizeof(i32)) - *(i32 *)out = *(i32 *)in + arg->i32_val; + if (arg->val_size == sizeof(int32_t)) + *(int32_t *)out = *(int32_t *)in + arg->i32_val; else *(int64_t *)out = *(int64_t *)in + arg->i64_val; } @@ -242,8 +242,8 @@ do_update_op_add(struct op_arith_arg *arg, const char *in, char *out) static void do_update_op_subtract(struct op_arith_arg *arg, const char *in, char *out) { - if (arg->val_size == sizeof(i32)) - *(i32 *)out = *(i32 *)in - arg->i32_val; + if (arg->val_size == sizeof(int32_t)) + *(int32_t *)out = *(int32_t *)in - arg->i32_val; else *(int64_t *)out = *(int64_t *)in - arg->i64_val; } @@ -251,8 +251,8 @@ do_update_op_subtract(struct op_arith_arg *arg, const char *in, char *out) static void do_update_op_and(struct op_arith_arg *arg, const char *in, char *out) { - if (arg->val_size == sizeof(i32)) - *(i32 *)out = *(i32 *)in & arg->i32_val; + if (arg->val_size == sizeof(int32_t)) + *(int32_t *)out = *(int32_t *)in & arg->i32_val; else *(int64_t *)out = *(int64_t *)in & arg->i64_val; } @@ -260,8 +260,8 @@ do_update_op_and(struct op_arith_arg *arg, const char *in, char *out) static void do_update_op_xor(struct op_arith_arg *arg, const char *in, char *out) { - if (arg->val_size == sizeof(i32)) - *(i32 *)out = *(i32 *)in ^ arg->i32_val; + if (arg->val_size == sizeof(int32_t)) + *(int32_t *)out = *(int32_t *)in ^ arg->i32_val; else *(int64_t *)out = *(int64_t *)in ^ arg->i64_val; } @@ -269,8 +269,8 @@ do_update_op_xor(struct op_arith_arg *arg, const char *in, char *out) static void do_update_op_or(struct op_arith_arg *arg, const char *in, char *out) { - if (arg->val_size == sizeof(i32)) - *(i32 *)out = *(i32 *)in | arg->i32_val; + if (arg->val_size == sizeof(int32_t)) + *(int32_t *)out = *(int32_t *)in | arg->i32_val; else *(int64_t *)out = *(int64_t *)in | arg->i64_val; } @@ -336,23 +336,23 @@ init_update_op_arith(struct tuple_update *update, struct update_op *op) u32 field_len = update_field_len(field); switch (field_len) { - case sizeof(i32): + case sizeof(int32_t): /* 32-bit operation */ /* Check the operand type. */ - if (op->arg.set.length != sizeof(i32)) + if (op->arg.set.length != sizeof(int32_t)) tnt_raise(ClientError, ER_ARG_TYPE, "32-bit int"); - arg->i32_val = *(i32 *)op->arg.set.value; + arg->i32_val = *(int32_t *)op->arg.set.value; break; case sizeof(int64_t): /* 64-bit operation */ switch (op->arg.set.length) { - case sizeof(i32): + case sizeof(int32_t): /* 32-bit operand */ /* cast 32-bit operand to 64-bit */ - arg->i64_val = *(i32 *)op->arg.set.value; + arg->i64_val = *(int32_t *)op->arg.set.value; break; case sizeof(int64_t): /* 64-bit operand */ diff --git a/src/tarantool.cc b/src/tarantool.cc index ed14d00fbee87208eb168a95029eee8eb0ffb1d2..22c8766928cd01244c674fa691ae51b7ded2d1d8 100644 --- a/src/tarantool.cc +++ b/src/tarantool.cc @@ -123,11 +123,11 @@ title(const char *fmt, ...) set_proc_title(buf); } -static i32 -load_cfg(struct tarantool_cfg *conf, i32 check_rdonly) +static int +load_cfg(struct tarantool_cfg *conf, int32_t check_rdonly) { FILE *f; - i32 n_accepted, n_skipped, n_ignored; + int32_t n_accepted, n_skipped, n_ignored; tbuf_reset(cfg_out); @@ -210,7 +210,7 @@ core_reload_config(const struct tarantool_cfg *old_conf, return 0; } -i32 +int reload_cfg(struct tbuf *out) { static struct mutex *mutex = NULL; diff --git a/test/connector_c/update.c b/test/connector_c/update.c index 21c85516dfef339a368181f0ab67b68cf38f72a9..4f357d7c1fee396770c7f2467058340816a88c7f 100644 --- a/test/connector_c/update.c +++ b/test/connector_c/update.c @@ -75,36 +75,36 @@ insert_tuple(struct tnt_tuple *tuple); /** select tuple by key */ void -select_tuple(i32 key); +select_tuple(int32_t key); /** update fields */ void -update(i32 key, struct tnt_stream *stream); +update(int32_t key, struct tnt_stream *stream); /** add update fields operation: set int32 */ void -update_set_i32(struct tnt_stream *stream, i32 field, i32 value); +update_set_i32(struct tnt_stream *stream, int32_t field, int32_t value); /** add update fields operation: set string */ void -update_set_str(struct tnt_stream *stream, i32 field, char *str); +update_set_str(struct tnt_stream *stream, int32_t field, char *str); /** add update fields operation: splice string */ void -update_splice_str(struct tnt_stream *stream, i32 field, i32 offset, i32 length, +update_splice_str(struct tnt_stream *stream, int32_t field, int32_t offset, int32_t length, char *list); /** add update fields operation: delete field */ void -update_delete_field(struct tnt_stream *stream, i32 field); +update_delete_field(struct tnt_stream *stream, int32_t field); /** add update fields operation: insert before int32 */ void -update_insert_i32(struct tnt_stream *stream, i32 field, i32 value); +update_insert_i32(struct tnt_stream *stream, int32_t field, int32_t value); /** add update fields operation: insert before string */ void -update_insert_str(struct tnt_stream *stream, i32 field, char *str); +update_insert_str(struct tnt_stream *stream, int32_t field, char *str); /** receive reply from server */ void @@ -226,7 +226,7 @@ insert_tuple(struct tnt_tuple *tuple) } void -select_tuple(i32 key) +select_tuple(int32_t key) { struct tnt_list tuple_list; tnt_list_init(&tuple_list); @@ -241,7 +241,7 @@ select_tuple(i32 key) } void -update(i32 key, struct tnt_stream *stream) +update(int32_t key, struct tnt_stream *stream) { struct tnt_tuple *k = tnt_tuple(NULL, "%d", key); if (tnt_update(tnt, 0, TNT_FLAG_RETURN, k, stream) < 0) @@ -253,7 +253,7 @@ update(i32 key, struct tnt_stream *stream) } void -update_set_i32(struct tnt_stream *stream, i32 field, i32 value) +update_set_i32(struct tnt_stream *stream, int32_t field, int32_t value) { int result = tnt_update_assign(stream, field, (char *)&value, sizeof(value)); if (result < 0) @@ -261,7 +261,7 @@ update_set_i32(struct tnt_stream *stream, i32 field, i32 value) } void -update_set_str(struct tnt_stream *stream, i32 field, char *str) +update_set_str(struct tnt_stream *stream, int32_t field, char *str) { int result = tnt_update_assign(stream, field, str, strlen(str)); if (result < 0) @@ -269,7 +269,7 @@ update_set_str(struct tnt_stream *stream, i32 field, char *str) } void -update_splice_str(struct tnt_stream *stream, i32 field, i32 offset, i32 length, +update_splice_str(struct tnt_stream *stream, int32_t field, int32_t offset, int32_t length, char *list) { int result = tnt_update_splice(stream, field, offset, length, list, @@ -279,7 +279,7 @@ update_splice_str(struct tnt_stream *stream, i32 field, i32 offset, i32 length, } void -update_delete_field(struct tnt_stream *stream, i32 field) +update_delete_field(struct tnt_stream *stream, int32_t field) { int result = tnt_update_delete(stream, field); if (result < 0) @@ -287,7 +287,7 @@ update_delete_field(struct tnt_stream *stream, i32 field) } void -update_insert_i32(struct tnt_stream *stream, i32 field, i32 value) +update_insert_i32(struct tnt_stream *stream, int32_t field, int32_t value) { int result = tnt_update_insert(stream, field, (char *)&value, sizeof(value)); @@ -296,7 +296,7 @@ update_insert_i32(struct tnt_stream *stream, i32 field, i32 value) } void -update_insert_str(struct tnt_stream *stream, i32 field, char *str) +update_insert_str(struct tnt_stream *stream, int32_t field, char *str) { int result = tnt_update_insert(stream, field, str, strlen(str)); if (result < 0) @@ -353,7 +353,7 @@ print_tuple(struct tnt_tuple *tuple) printf("%"PRIi16" (0x%04"PRIx16")", *(int16_t *)data, *(int16_t *)data); break; case 4: - printf("%"PRIi32" (0x%08"PRIx32")", *(i32 *)data, *(i32 *)data); + printf("%"PRIi32" (0x%08"PRIx32")", *(int32_t *)data, *(int32_t *)data); break; case 8: printf("%"PRIi64" (0x%016"PRIx64")", *(int64_t *)data, *(int64_t *)data);