From fb8dfb7cf71a31b2042f8d9ea87090327f9695e6 Mon Sep 17 00:00:00 2001
From: Konstantin Osipov <kostja@tarantool.org>
Date: Mon, 1 Jul 2013 17:17:50 +0400
Subject: [PATCH] Remove deprecated typedef i64.

---
 include/log_io.h          | 14 +++++++-------
 include/recovery.h        |  8 ++++----
 include/salloc.h          | 10 +++++-----
 include/stat.h            |  4 ++--
 include/tarantool/util.h  |  1 -
 src/admin.cc              |  4 ++--
 src/admin.rl              |  4 ++--
 src/box/tuple_update.cc   | 18 +++++++++---------
 src/log_io.cc             | 28 ++++++++++++++--------------
 src/lua/stat.cc           |  6 +++---
 src/memcached.cc          |  4 ++--
 src/recovery.cc           | 12 ++++++------
 src/replica.cc            |  4 ++--
 src/replication.cc        |  2 +-
 src/stat.cc               |  4 ++--
 test/connector_c/update.c |  2 +-
 16 files changed, 62 insertions(+), 63 deletions(-)

diff --git a/include/log_io.h b/include/log_io.h
index b49caa2087..8a3cf2fc8a 100644
--- a/include/log_io.h
+++ b/include/log_io.h
@@ -63,12 +63,12 @@ struct log_dir {
 extern struct log_dir snap_dir;
 extern struct log_dir wal_dir;
 
-i64
+int64_t
 greatest_lsn(struct log_dir *dir);
 char *
-format_filename(struct log_dir *dir, i64 lsn, enum log_suffix suffix);
-i64
-find_including_file(struct log_dir *dir, i64 target_lsn);
+format_filename(struct log_dir *dir, int64_t lsn, enum log_suffix suffix);
+int64_t
+find_including_file(struct log_dir *dir, int64_t target_lsn);
 
 struct log_io {
 	struct log_dir *dir;
@@ -83,9 +83,9 @@ struct log_io {
 };
 
 struct log_io *
-log_io_open_for_read(struct log_dir *dir, i64 lsn, enum log_suffix suffix);
+log_io_open_for_read(struct log_dir *dir, int64_t lsn, enum log_suffix suffix);
 struct log_io *
-log_io_open_for_write(struct log_dir *dir, i64 lsn, enum log_suffix suffix);
+log_io_open_for_write(struct log_dir *dir, int64_t lsn, enum log_suffix suffix);
 struct log_io *
 log_io_open(struct log_dir *dir, enum log_mode mode,
 	    const char *filename, enum log_suffix suffix, FILE *file);
@@ -116,7 +116,7 @@ typedef u32 log_magic_t;
 
 struct header_v11 {
 	u32 header_crc32c;
-	i64 lsn;
+	int64_t lsn;
 	double tm;
 	u32 len;
 	u32 data_crc32c;
diff --git a/include/recovery.h b/include/recovery.h
index c9d372cfe3..62c4082a35 100644
--- a/include/recovery.h
+++ b/include/recovery.h
@@ -51,11 +51,11 @@ typedef int (row_handler)(void *, const char *, uint32_t);
 
 struct wait_lsn {
 	struct fiber *waiter;
-	i64 lsn;
+	int64_t lsn;
 };
 
 void
-wait_lsn_set(struct wait_lsn *wait_lsn, i64 lsn);
+wait_lsn_set(struct wait_lsn *wait_lsn, int64_t lsn);
 
 inline static void
 wait_lsn_clear(struct wait_lsn *wait_lsn)
@@ -81,7 +81,7 @@ enum wal_mode { WAL_NONE = 0, WAL_WRITE, WAL_FSYNC, WAL_FSYNC_DELAY, WAL_MODE_MA
 extern const char *wal_mode_STRS[];
 
 struct recovery_state {
-	i64 lsn, confirmed_lsn;
+	int64_t lsn, confirmed_lsn;
 	/* The WAL we're currently reading/writing from/to. */
 	struct log_io *current_wal;
 	struct log_dir *snap_dir;
@@ -122,7 +122,7 @@ void recover_snap(struct recovery_state *);
 void recover_existing_wals(struct recovery_state *);
 void recovery_follow_local(struct recovery_state *r, ev_tstamp wal_dir_rescan_delay);
 void recovery_finalize(struct recovery_state *r);
-int wal_write(struct recovery_state *r, i64 lsn, u64 cookie,
+int wal_write(struct recovery_state *r, int64_t lsn, u64 cookie,
 	      uint16_t op, const char *data, u32 len);
 
 void recovery_setup_panic(struct recovery_state *r, bool on_snap_error, bool on_wal_error);
diff --git a/include/salloc.h b/include/salloc.h
index 0b9cd53ec0..83d59605e3 100644
--- a/include/salloc.h
+++ b/include/salloc.h
@@ -42,11 +42,11 @@ void slab_validate();
 
 /** Statistics on utilization of a single slab class. */
 struct slab_cache_stats {
-	i64 item_size;
-	i64 slabs;
-	i64 items;
-	i64 bytes_used;
-	i64 bytes_free;
+	int64_t item_size;
+	int64_t slabs;
+	int64_t items;
+	int64_t bytes_used;
+	int64_t bytes_free;
 };
 
 /** Statistics on utilization of the slab allocator. */
diff --git a/include/stat.h b/include/stat.h
index 478eeb4f4c..26b9fdb4e1 100644
--- a/include/stat.h
+++ b/include/stat.h
@@ -36,9 +36,9 @@ void stat_cleanup(int base, size_t max_idx);
 int stat_register(const char **name, size_t count);
 extern int stat_max_name_len;
 
-void stat_collect(int base, int name, i64 value);
+void stat_collect(int base, int name, int64_t value);
 
-typedef int (*stat_cb)(const char *name, int rps, i64 total, void *cb_ctx);
+typedef int (*stat_cb)(const char *name, int rps, int64_t total, void *cb_ctx);
 
 int stat_foreach(stat_cb cb, void *cb_ctx);
 
diff --git a/include/tarantool/util.h b/include/tarantool/util.h
index 8825ce4085..cb9a302190 100644
--- a/include/tarantool/util.h
+++ b/include/tarantool/util.h
@@ -124,7 +124,6 @@ strindex(const char **haystack, const char *needle, uint32_t hmax);
 typedef uint32_t u32;
 typedef uint64_t u64;
 typedef int32_t i32;
-typedef int64_t i64;
 
 #define CRLF "\n"
 
diff --git a/src/admin.cc b/src/admin.cc
index 02f717a0a6..6512d9d424 100644
--- a/src/admin.cc
+++ b/src/admin.cc
@@ -91,7 +91,7 @@ static const int admin_en_main = 1;
 
 
 struct salloc_stat_admin_cb_ctx {
-	i64 total_used;
+	int64_t total_used;
 	struct tbuf *out;
 };
 
@@ -186,7 +186,7 @@ tarantool_info(struct tbuf *out)
 }
 
 static int
-show_stat_item(const char *name, int rps, i64 total, void *ctx)
+show_stat_item(const char *name, int rps, int64_t total, void *ctx)
 {
 	struct tbuf *buf = (struct tbuf *) ctx;
 	int name_len = strlen(name);
diff --git a/src/admin.rl b/src/admin.rl
index 56bd8b3000..f336ca78ee 100644
--- a/src/admin.rl
+++ b/src/admin.rl
@@ -82,7 +82,7 @@ static const char *unknown_command = "unknown command. try typing help." CRLF;
 }%%
 
 struct salloc_stat_admin_cb_ctx {
-	i64 total_used;
+	int64_t total_used;
 	struct tbuf *out;
 };
 
@@ -177,7 +177,7 @@ tarantool_info(struct tbuf *out)
 }
 
 static int
-show_stat_item(const char *name, int rps, i64 total, void *ctx)
+show_stat_item(const char *name, int rps, int64_t total, void *ctx)
 {
 	struct tbuf *buf = (struct tbuf *) ctx;
 	int name_len = strlen(name);
diff --git a/src/box/tuple_update.cc b/src/box/tuple_update.cc
index f239823133..0f4e0d37e6 100644
--- a/src/box/tuple_update.cc
+++ b/src/box/tuple_update.cc
@@ -122,7 +122,7 @@ struct op_arith_arg {
 	u32 val_size;
 	union {
 		i32 i32_val;
-		i64 i64_val;
+		int64_t i64_val;
 	};
 };
 
@@ -236,7 +236,7 @@ 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;
 	else
-		*(i64 *)out = *(i64 *)in + arg->i64_val;
+		*(int64_t *)out = *(int64_t *)in + arg->i64_val;
 }
 
 static void
@@ -245,7 +245,7 @@ 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;
 	else
-		*(i64 *)out = *(i64 *)in - arg->i64_val;
+		*(int64_t *)out = *(int64_t *)in - arg->i64_val;
 }
 
 static void
@@ -254,7 +254,7 @@ 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;
 	else
-		*(i64 *)out = *(i64 *)in & arg->i64_val;
+		*(int64_t *)out = *(int64_t *)in & arg->i64_val;
 }
 
 static void
@@ -263,7 +263,7 @@ 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;
 	else
-		*(i64 *)out = *(i64 *)in ^ arg->i64_val;
+		*(int64_t *)out = *(int64_t *)in ^ arg->i64_val;
 }
 
 static void
@@ -272,7 +272,7 @@ 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;
 	else
-		*(i64 *)out = *(i64 *)in | arg->i64_val;
+		*(int64_t *)out = *(int64_t *)in | arg->i64_val;
 }
 
 static void
@@ -346,7 +346,7 @@ init_update_op_arith(struct tuple_update *update, struct update_op *op)
 
 		arg->i32_val = *(i32 *)op->arg.set.value;
 		break;
-	case sizeof(i64):
+	case sizeof(int64_t):
 		/* 64-bit operation */
 		switch (op->arg.set.length) {
 		case sizeof(i32):
@@ -354,9 +354,9 @@ init_update_op_arith(struct tuple_update *update, struct update_op *op)
 			/* cast 32-bit operand to 64-bit */
 			arg->i64_val = *(i32 *)op->arg.set.value;
 			break;
-		case sizeof(i64):
+		case sizeof(int64_t):
 			/* 64-bit operand */
-			arg->i64_val = *(i64 *)op->arg.set.value;
+			arg->i64_val = *(int64_t *)op->arg.set.value;
 			break;
 		default:
 			tnt_raise(ClientError, ER_ARG_TYPE,
diff --git a/src/log_io.cc b/src/log_io.cc
index d4e56465d6..1e02b84ccb 100644
--- a/src/log_io.cc
+++ b/src/log_io.cc
@@ -87,19 +87,19 @@ struct log_dir wal_dir = {
 static int
 cmp_i64(const void *_a, const void *_b)
 {
-	const i64 *a = (const i64 *) _a, *b = (const i64 *) _b;
+	const int64_t *a = (const int64_t *) _a, *b = (const int64_t *) _b;
 	if (*a == *b)
 		return 0;
 	return (*a > *b) ? 1 : -1;
 }
 
 static ssize_t
-scan_dir(struct log_dir *dir, i64 **ret_lsn)
+scan_dir(struct log_dir *dir, int64_t **ret_lsn)
 {
 	ssize_t result = -1;
 	size_t i = 0, size = 1024;
 	ssize_t ext_len = strlen(dir->filename_ext);
-	i64 *lsn = (i64 *) palloc(fiber->gc_pool, sizeof(i64) * size);
+	int64_t *lsn = (int64_t *) palloc(fiber->gc_pool, sizeof(int64_t) * size);
 	DIR *dh = opendir(dir->dirname);
 
 	if (lsn == NULL || dh == NULL)
@@ -143,16 +143,16 @@ scan_dir(struct log_dir *dir, i64 **ret_lsn)
 
 		i++;
 		if (i == size) {
-			i64 *n = (i64 *) palloc(fiber->gc_pool, sizeof(i64) * size * 2);
+			int64_t *n = (int64_t *) palloc(fiber->gc_pool, sizeof(int64_t) * size * 2);
 			if (n == NULL)
 				goto out;
-			memcpy(n, lsn, sizeof(i64) * size);
+			memcpy(n, lsn, sizeof(int64_t) * size);
 			lsn = n;
 			size = size * 2;
 		}
 	}
 
-	qsort(lsn, i, sizeof(i64), cmp_i64);
+	qsort(lsn, i, sizeof(int64_t), cmp_i64);
 
 	*ret_lsn = lsn;
 	result = i;
@@ -165,10 +165,10 @@ scan_dir(struct log_dir *dir, i64 **ret_lsn)
 	return result;
 }
 
-i64
+int64_t
 greatest_lsn(struct log_dir *dir)
 {
-	i64 *lsn;
+	int64_t *lsn;
 	ssize_t count = scan_dir(dir, &lsn);
 
 	if (count <= 0)
@@ -177,10 +177,10 @@ greatest_lsn(struct log_dir *dir)
 	return lsn[count - 1];
 }
 
-i64
-find_including_file(struct log_dir *dir, i64 target_lsn)
+int64_t
+find_including_file(struct log_dir *dir, int64_t target_lsn)
 {
-	i64 *lsn;
+	int64_t *lsn;
 	ssize_t count = scan_dir(dir, &lsn);
 
 	if (count <= 0)
@@ -206,7 +206,7 @@ find_including_file(struct log_dir *dir, i64 target_lsn)
 }
 
 char *
-format_filename(struct log_dir *dir, i64 lsn, enum log_suffix suffix)
+format_filename(struct log_dir *dir, int64_t lsn, enum log_suffix suffix)
 {
 	static __thread char filename[PATH_MAX + 1];
 	const char *suffix_str = suffix == INPROGRESS ? inprogress_suffix : "";
@@ -609,7 +609,7 @@ log_io_open(struct log_dir *dir, enum log_mode mode,
 }
 
 struct log_io *
-log_io_open_for_read(struct log_dir *dir, i64 lsn, enum log_suffix suffix)
+log_io_open_for_read(struct log_dir *dir, int64_t lsn, enum log_suffix suffix)
 {
 	assert(lsn != 0);
 
@@ -623,7 +623,7 @@ log_io_open_for_read(struct log_dir *dir, i64 lsn, enum log_suffix suffix)
  * and sets errno.
  */
 struct log_io *
-log_io_open_for_write(struct log_dir *dir, i64 lsn, enum log_suffix suffix)
+log_io_open_for_write(struct log_dir *dir, int64_t lsn, enum log_suffix suffix)
 {
 	char *filename;
 	FILE *f;
diff --git a/src/lua/stat.cc b/src/lua/stat.cc
index 5fdfe919d1..04078ae58c 100644
--- a/src/lua/stat.cc
+++ b/src/lua/stat.cc
@@ -39,7 +39,7 @@ extern "C" {
 } /* extern "C" */
 
 static void
-fill_stat_item(struct lua_State *L, int rps, i64 total)
+fill_stat_item(struct lua_State *L, int rps, int64_t total)
 {
 	lua_pushstring(L, "rps");
 	lua_pushnumber(L, rps);
@@ -51,7 +51,7 @@ fill_stat_item(struct lua_State *L, int rps, i64 total)
 }
 
 static int
-set_stat_item(const char *name, int rps, i64 total, void *cb_ctx)
+set_stat_item(const char *name, int rps, int64_t total, void *cb_ctx)
 {
 	struct lua_State *L = (struct lua_State *) cb_ctx;
 
@@ -70,7 +70,7 @@ set_stat_item(const char *name, int rps, i64 total, void *cb_ctx)
  * box.stats.DELETE.
  */
 static int
-seek_stat_item(const char *name, int rps, i64 total, void *cb_ctx)
+seek_stat_item(const char *name, int rps, int64_t total, void *cb_ctx)
 {
 	struct lua_State *L = (struct lua_State *) cb_ctx;
 	if (strcmp(name, lua_tostring(L, -1)) != 0)
diff --git a/src/memcached.cc b/src/memcached.cc
index 3ed233fc0c..d311241986 100644
--- a/src/memcached.cc
+++ b/src/memcached.cc
@@ -216,8 +216,8 @@ static struct stats {
 } stats;
 
 struct salloc_stat_memcached_cb_ctx {
-	i64 bytes_used;
-	i64 items;
+	int64_t bytes_used;
+	int64_t items;
 };
 
 static int
diff --git a/src/recovery.cc b/src/recovery.cc
index c0b69fd619..4882ae3360 100644
--- a/src/recovery.cc
+++ b/src/recovery.cc
@@ -292,7 +292,7 @@ recover_snap(struct recovery_state *r)
 	say_info("recovery start");
 
 	struct log_io *snap;
-	i64 lsn;
+	int64_t lsn;
 
 	lsn = greatest_lsn(r->snap_dir);
 	if (lsn <= 0) {
@@ -353,7 +353,7 @@ recover_wal(struct recovery_state *r, struct log_io *l)
 	const char *row;
 	uint32_t rowlen;
 	while ((row = log_io_cursor_next(&i, &rowlen))) {
-		i64 lsn = header_v11(row)->lsn;
+		int64_t lsn = header_v11(row)->lsn;
 		if (lsn <= r->confirmed_lsn) {
 			say_debug("skipping too young row");
 			continue;
@@ -387,7 +387,7 @@ recover_remaining_wals(struct recovery_state *r)
 {
 	int result = 0;
 	struct log_io *next_wal;
-	i64 current_lsn, wal_greatest_lsn;
+	int64_t current_lsn, wal_greatest_lsn;
 	size_t rows_before;
 	FILE *f;
 	char *filename;
@@ -510,8 +510,8 @@ recover_remaining_wals(struct recovery_state *r)
 void
 recover_existing_wals(struct recovery_state *r)
 {
-	i64 next_lsn = r->confirmed_lsn + 1;
-	i64 wal_lsn = find_including_file(r->wal_dir, next_lsn);
+	int64_t next_lsn = r->confirmed_lsn + 1;
+	int64_t wal_lsn = find_including_file(r->wal_dir, next_lsn);
 	if (wal_lsn <= 0) {
 		/* No WALs to recover from. */
 		goto out;
@@ -1105,7 +1105,7 @@ wal_writer_thread(void *worker_args)
  * to be written to disk and wait until this task is completed.
  */
 int
-wal_write(struct recovery_state *r, i64 lsn, u64 cookie,
+wal_write(struct recovery_state *r, int64_t lsn, u64 cookie,
 	  uint16_t op, const char *row, u32 row_len)
 {
 	say_debug("wal_write lsn=%" PRIi64, lsn);
diff --git a/src/replica.cc b/src/replica.cc
index 5dd95d28a8..9dad68dc76 100644
--- a/src/replica.cc
+++ b/src/replica.cc
@@ -66,7 +66,7 @@ remote_read_row(struct ev_io *coio, struct iobuf *iobuf, uint32_t *rowlen)
 
 static void
 remote_connect(struct ev_io *coio, struct sockaddr_in *remote_addr,
-	       i64 initial_lsn, const char **err)
+	       int64_t initial_lsn, const char **err)
 {
 	evio_socket(coio, AF_INET, SOCK_STREAM, IPPROTO_TCP);
 
@@ -143,7 +143,7 @@ pull_from_remote(va_list ap)
 static void
 remote_apply_row(struct recovery_state *r, const char *row, uint32_t rowlen)
 {
-	i64 lsn = header_v11(row)->lsn;
+	int64_t lsn = header_v11(row)->lsn;
 
 	assert(*(uint16_t*)(row + sizeof(struct header_v11)) == XLOG);
 
diff --git a/src/replication.cc b/src/replication.cc
index 5bcc946a4f..508bf30bec 100644
--- a/src/replication.cc
+++ b/src/replication.cc
@@ -586,7 +586,7 @@ replication_relay_loop(int client_sock)
 {
 	char name[FIBER_NAME_MAXLEN];
 	struct sigaction sa;
-	i64 lsn;
+	int64_t lsn;
 	ssize_t r;
 
 	/* Set process title and fiber name.
diff --git a/src/stat.cc b/src/stat.cc
index ad26f2a6e1..61148743cf 100644
--- a/src/stat.cc
+++ b/src/stat.cc
@@ -40,7 +40,7 @@ static ev_timer timer;
 
 struct stats {
 	const char *name;
-	i64 value[SECS + 1];
+	int64_t value[SECS + 1];
 } *stats = NULL;
 static int stats_size = 0;
 static int stats_max = 0;
@@ -87,7 +87,7 @@ stat_register(const char **name, size_t max_idx)
 }
 
 void
-stat_collect(int base, int name, i64 value)
+stat_collect(int base, int name, int64_t value)
 {
 	stats[base + name].value[0] += value;
 	stats[base + name].value[SECS] += value;
diff --git a/test/connector_c/update.c b/test/connector_c/update.c
index fa1e71bba1..21c85516df 100644
--- a/test/connector_c/update.c
+++ b/test/connector_c/update.c
@@ -356,7 +356,7 @@ print_tuple(struct tnt_tuple *tuple)
 			printf("%"PRIi32" (0x%08"PRIx32")", *(i32 *)data, *(i32 *)data);
 			break;
 		case 8:
-			printf("%"PRIi64" (0x%016"PRIx64")", *(i64 *)data, *(i64 *)data);
+			printf("%"PRIi64" (0x%016"PRIx64")", *(int64_t *)data, *(int64_t *)data);
 			break;
 		default:
 			printf("'%.*s'", size, data);
-- 
GitLab