Commit e1c13971 authored by marko's avatar marko

branches/zip: Minor cleanup.

Add __attribute__((const)) or __attribute__((pure)) to various
mach_read functions.

dtype_new_read_for_order_and_null_size(): Remove a statement
without effect: mach_read_from_2(buf + 4).
parent 6688b863
......@@ -339,8 +339,6 @@ dtype_new_read_for_order_and_null_size(
type->len = mach_read_from_2(buf + 2);
mach_read_from_2(buf + 4);
charset_coll = mach_read_from_2(buf + 4) & 0x7fff;
if (dtype_is_string_type(type->mtype)) {
......
......@@ -33,7 +33,8 @@ ulint
mach_read_from_1(
/*=============*/
/* out: ulint integer, >= 0, < 256 */
const byte* b); /* in: pointer to byte */
const byte* b) /* in: pointer to byte */
__attribute__((nonnull, pure));
/***********************************************************
The following function is used to store data in two consecutive
bytes. We store the most significant byte to the lower address. */
......@@ -51,7 +52,8 @@ ulint
mach_read_from_2(
/*=============*/
/* out: ulint integer, >= 0, < 64k */
const byte* b); /* in: pointer to two bytes */
const byte* b) /* in: pointer to two bytes */
__attribute__((nonnull, pure));
/************************************************************
The following function is used to convert a 16-bit data item
......@@ -62,7 +64,8 @@ uint16
mach_encode_2(
/*==========*/
/* out: 16-bit integer in canonical format */
ulint n); /* in: integer in machine-dependent format */
ulint n) /* in: integer in machine-dependent format */
__attribute__((const));
/************************************************************
The following function is used to convert a 16-bit data item
from the canonical format, for fast bytewise equality test
......@@ -72,7 +75,8 @@ ulint
mach_decode_2(
/*==========*/
/* out: integer in machine-dependent format */
uint16 n); /* in: 16-bit integer in canonical format */
uint16 n) /* in: 16-bit integer in canonical format */
__attribute__((const));
/***********************************************************
The following function is used to store data in 3 consecutive
bytes. We store the most significant byte to the lowest address. */
......@@ -90,7 +94,8 @@ ulint
mach_read_from_3(
/*=============*/
/* out: ulint integer */
const byte* b); /* in: pointer to 3 bytes */
const byte* b) /* in: pointer to 3 bytes */
__attribute__((nonnull, pure));
/***********************************************************
The following function is used to store data in four consecutive
bytes. We store the most significant byte to the lowest address. */
......@@ -108,7 +113,8 @@ ulint
mach_read_from_4(
/*=============*/
/* out: ulint integer */
const byte* b); /* in: pointer to four bytes */
const byte* b) /* in: pointer to four bytes */
__attribute__((nonnull, pure));
/*************************************************************
Writes a ulint in a compressed form (1..5 bytes). */
UNIV_INLINE
......@@ -125,7 +131,8 @@ ulint
mach_get_compressed_size(
/*=====================*/
/* out: compressed size in bytes */
ulint n); /* in: ulint integer to be stored */
ulint n) /* in: ulint integer to be stored */
__attribute__((const));
/*************************************************************
Reads a ulint in a compressed form. */
UNIV_INLINE
......@@ -133,7 +140,8 @@ ulint
mach_read_compressed(
/*=================*/
/* out: read integer */
const byte* b); /* in: pointer to memory from where to read */
const byte* b) /* in: pointer to memory from where to read */
__attribute__((nonnull, pure));
/***********************************************************
The following function is used to store data in 6 consecutive
bytes. We store the most significant byte to the lowest address. */
......@@ -151,7 +159,8 @@ dulint
mach_read_from_6(
/*=============*/
/* out: dulint integer */
const byte* b); /* in: pointer to 6 bytes */
const byte* b) /* in: pointer to 6 bytes */
__attribute__((nonnull, pure));
/***********************************************************
The following function is used to store data in 7 consecutive
bytes. We store the most significant byte to the lowest address. */
......@@ -169,7 +178,8 @@ dulint
mach_read_from_7(
/*=============*/
/* out: dulint integer */
const byte* b); /* in: pointer to 7 bytes */
const byte* b) /* in: pointer to 7 bytes */
__attribute__((nonnull, pure));
/***********************************************************
The following function is used to store data in 8 consecutive
bytes. We store the most significant byte to the lowest address. */
......@@ -196,7 +206,8 @@ dulint
mach_read_from_8(
/*=============*/
/* out: dulint integer */
const byte* b); /* in: pointer to 8 bytes */
const byte* b) /* in: pointer to 8 bytes */
__attribute__((nonnull, pure));
/************************************************************
The following function is used to fetch data from 8 consecutive
bytes. The most significant byte is at the lowest address. */
......@@ -205,7 +216,8 @@ ib_uint64_t
mach_read_ull(
/*==========*/
/* out: 64-bit integer */
const byte* b); /* in: pointer to 8 bytes */
const byte* b) /* in: pointer to 8 bytes */
__attribute__((nonnull, pure));
/*************************************************************
Writes a dulint in a compressed form (5..9 bytes). */
UNIV_INLINE
......@@ -230,7 +242,8 @@ dulint
mach_dulint_read_compressed(
/*========================*/
/* out: read dulint */
const byte* b); /* in: pointer to memory from where to read */
const byte* b) /* in: pointer to memory from where to read */
__attribute__((nonnull, pure));
/*************************************************************
Writes a dulint in a compressed form (1..11 bytes). */
UNIV_INLINE
......@@ -247,7 +260,8 @@ ulint
mach_dulint_get_much_compressed_size(
/*=================================*/
/* out: compressed size in bytes */
dulint n); /* in: dulint integer to be stored */
dulint n) /* in: dulint integer to be stored */
__attribute__((const));
/*************************************************************
Reads a dulint in a compressed form. */
UNIV_INLINE
......@@ -255,7 +269,8 @@ dulint
mach_dulint_read_much_compressed(
/*=============================*/
/* out: read dulint */
const byte* b); /* in: pointer to memory from where to read */
const byte* b) /* in: pointer to memory from where to read */
__attribute__((nonnull, pure));
/*************************************************************
Reads a ulint in a compressed form if the log record fully contains it. */
......@@ -285,7 +300,8 @@ double
mach_double_read(
/*=============*/
/* out: double read */
const byte* b); /* in: pointer to memory from where to read */
const byte* b) /* in: pointer to memory from where to read */
__attribute__((nonnull, pure));
/*************************************************************
Writes a double. It is stored in a little-endian format. */
UNIV_INLINE
......@@ -301,7 +317,8 @@ float
mach_float_read(
/*============*/
/* out: float read */
const byte* b); /* in: pointer to memory from where to read */
const byte* b) /* in: pointer to memory from where to read */
__attribute__((nonnull, pure));
/*************************************************************
Writes a float. It is stored in a little-endian format. */
UNIV_INLINE
......@@ -318,7 +335,8 @@ mach_read_from_n_little_endian(
/*===========================*/
/* out: unsigned long int */
const byte* buf, /* in: from where to read */
ulint buf_size); /* in: from how many bytes to read */
ulint buf_size) /* in: from how many bytes to read */
__attribute__((nonnull, pure));
/*************************************************************
Writes a ulint in the little-endian format. */
UNIV_INLINE
......@@ -335,7 +353,8 @@ ulint
mach_read_from_2_little_endian(
/*===========================*/
/* out: unsigned long int */
const byte* buf); /* in: from where to read */
const byte* buf) /* in: from where to read */
__attribute__((nonnull, pure));
/*************************************************************
Writes a ulint in the little-endian format. */
UNIV_INLINE
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment