diff options
author | unknown <marko@hundin.mysql.fi> | 2004-05-17 14:40:31 +0300 |
---|---|---|
committer | unknown <marko@hundin.mysql.fi> | 2004-05-17 14:40:31 +0300 |
commit | 6b237533f1baae131e192ccbafcfcfaef13f4fc0 (patch) | |
tree | 17e1fcb0d47194292389b6b6d5d0b78c2695e328 /innobase/os | |
parent | 1915bfebcb9005102c72028221bb89aa5f0204e4 (diff) | |
download | mariadb-git-6b237533f1baae131e192ccbafcfcfaef13f4fc0.tar.gz |
InnoDB cleanup: Add const qualifiers to many char* arguments
innobase/dict/dict0dict.c:
Replace char* arguments with const char*
innobase/dict/dict0load.c:
Replace char* arguments with const char*
innobase/dict/dict0mem.c:
Replace char* arguments with const char*
innobase/fil/fil0fil.c:
Replace char* arguments with const char*
innobase/include/data0data.h:
dfield_set_data(): add const qualifier
innobase/include/data0data.ic:
dfield_set_data(): add const qualifier
(temporarily shut up compiler warnings)
innobase/include/dict0dict.h:
Replace char* arguments with const char*
innobase/include/dict0dict.ic:
Replace char* arguments with const char*
innobase/include/dict0load.h:
Replace char* arguments with const char*
innobase/include/dict0mem.h:
Replace char* arguments with const char*
innobase/include/fil0fil.h:
Replace char* arguments with const char*
innobase/include/os0file.h:
Replace char* arguments with const char*
innobase/include/os0sync.h:
Replace char* arguments with const char*
innobase/include/pars0pars.h:
Replace char* arguments with const char*
innobase/include/pars0sym.h:
Replace char* arguments with const char*
innobase/include/row0mysql.h:
Replace char* arguments with const char*
innobase/include/row0sel.h:
Replace char* arguments with const char*
innobase/include/trx0roll.h:
Replace char* arguments with const char*
innobase/include/trx0sys.h:
Replace char* arguments with const char*
innobase/include/trx0trx.h:
Replace char* arguments with const char*
innobase/include/ut0rnd.h:
Replace char* arguments with const char*
innobase/include/ut0rnd.ic:
Replace char* arguments with const char*
innobase/include/ut0ut.h:
Remove unused function ut_printf()
innobase/os/os0file.c:
Replace char* arguments with const char*
innobase/os/os0sync.c:
Replace char* arguments with const char*
innobase/pars/pars0pars.c:
Replace char* arguments with const char*
innobase/pars/pars0sym.c:
Use mem_heap_strdupl() instead of mem_heap_alloc() and memcpy()
innobase/row/row0mysql.c:
Replace char* arguments with const char*
innobase/row/row0sel.c:
Replace char* arguments with const char*
innobase/trx/trx0roll.c:
Replace char* arguments with const char*
innobase/trx/trx0sys.c:
Replace char* arguments with const char*
Diffstat (limited to 'innobase/os')
-rw-r--r-- | innobase/os/os0file.c | 163 | ||||
-rw-r--r-- | innobase/os/os0sync.c | 18 |
2 files changed, 96 insertions, 85 deletions
diff --git a/innobase/os/os0file.c b/innobase/os/os0file.c index 1a158372563..5f5060c7464 100644 --- a/innobase/os/os0file.c +++ b/innobase/os/os0file.c @@ -70,7 +70,7 @@ struct os_aio_slot_struct{ bytes */ ulint offset_high; /* 32 high bits of file offset */ os_file_t file; /* file where to read or write */ - char* name; /* file name or path */ + const char* name; /* file name or path */ ibool io_already_done;/* used only in simulated aio: TRUE if the physical i/o already made and only the slot message @@ -415,7 +415,7 @@ os_file_handle_error_no_exit( /* out: TRUE if we should retry the operation */ os_file_t file, /* in: file pointer */ - char* name, /* in: name of a file or NULL */ + const char* name, /* in: name of a file or NULL */ const char* operation)/* in: operation */ { ulint err; @@ -493,13 +493,15 @@ and '..' items at the start of the directory listing. */ os_file_dir_t os_file_opendir( /*============*/ - /* out: directory stream, NULL if error */ - char* dirname, /* in: directory name; it must not contain - a trailing '\' or '/' */ - ibool error_is_fatal) /* in: TRUE if we should treat an error as a - fatal error; if we try to open symlinks then - we do not wish a fatal error if it happens - not to be a directory */ + /* out: directory stream, NULL if + error */ + const char* dirname, /* in: directory name; it must not + contain a trailing '\' or '/' */ + ibool error_is_fatal) /* in: TRUE if we should treat an + error as a fatal error; if we try to + open symlinks then we do not wish a + fatal error if it happens not to be + a directory */ { os_file_dir_t dir; #ifdef __WIN__ @@ -585,7 +587,7 @@ os_file_readdir_next_file( /*======================*/ /* out: 0 if ok, -1 if error, 1 if at the end of the directory */ - char* dirname,/* in: directory name or path */ + const char* dirname,/* in: directory name or path */ os_file_dir_t dir, /* in: directory stream */ os_file_stat_t* info) /* in/out: buffer where the info is returned */ { @@ -704,12 +706,12 @@ fail_if_exists arguments is true. */ ibool os_file_create_directory( /*=====================*/ - /* out: TRUE if call succeeds, FALSE on - error */ - char* pathname, /* in: directory name as null-terminated - string */ - ibool fail_if_exists) /* in: if TRUE, pre-existing directory is - treated as an error. */ + /* out: TRUE if call succeeds, + FALSE on error */ + const char* pathname, /* in: directory name as + null-terminated string */ + ibool fail_if_exists) /* in: if TRUE, pre-existing directory + is treated as an error. */ { #ifdef __WIN__ BOOL rcode; @@ -746,18 +748,21 @@ A simple function to open or create a file. */ os_file_t os_file_create_simple( /*==================*/ - /* out, own: handle to the file, not defined if error, - error number can be retrieved with - os_file_get_last_error */ - char* name, /* in: name of the file or path as a null-terminated - string */ - ulint create_mode,/* in: OS_FILE_OPEN if an existing file is opened - (if does not exist, error), or OS_FILE_CREATE if a new - file is created (if exists, error), or - OS_FILE_CREATE_PATH if new file (if exists, error) and - subdirectories along its path are created (if needed)*/ - ulint access_type,/* in: OS_FILE_READ_ONLY or OS_FILE_READ_WRITE */ - ibool* success)/* out: TRUE if succeed, FALSE if error */ + /* out, own: handle to the file, not defined + if error, error number can be retrieved with + os_file_get_last_error */ + const char* name, /* in: name of the file or path as a + null-terminated string */ + ulint create_mode,/* in: OS_FILE_OPEN if an existing file is + opened (if does not exist, error), or + OS_FILE_CREATE if a new file is created + (if exists, error), or + OS_FILE_CREATE_PATH if new file + (if exists, error) and subdirectories along + its path are created (if needed)*/ + ulint access_type,/* in: OS_FILE_READ_ONLY or + OS_FILE_READ_WRITE */ + ibool* success)/* out: TRUE if succeed, FALSE if error */ { #ifdef __WIN__ os_file_t file; @@ -882,18 +887,20 @@ A simple function to open or create a file. */ os_file_t os_file_create_simple_no_error_handling( /*====================================*/ - /* out, own: handle to the file, not defined if error, - error number can be retrieved with - os_file_get_last_error */ - char* name, /* in: name of the file or path as a null-terminated - string */ - ulint create_mode,/* in: OS_FILE_OPEN if an existing file is opened - (if does not exist, error), or OS_FILE_CREATE if a new - file is created (if exists, error) */ - ulint access_type,/* in: OS_FILE_READ_ONLY, OS_FILE_READ_WRITE, or - OS_FILE_READ_ALLOW_DELETE; the last option is used by - a backup program reading the file */ - ibool* success)/* out: TRUE if succeed, FALSE if error */ + /* out, own: handle to the file, not defined + if error, error number can be retrieved with + os_file_get_last_error */ + const char* name, /* in: name of the file or path as a + null-terminated string */ + ulint create_mode,/* in: OS_FILE_OPEN if an existing file + is opened (if does not exist, error), or + OS_FILE_CREATE if a new file is created + (if exists, error) */ + ulint access_type,/* in: OS_FILE_READ_ONLY, + OS_FILE_READ_WRITE, or + OS_FILE_READ_ALLOW_DELETE; the last option is + used by a backup program reading the file */ + ibool* success)/* out: TRUE if succeed, FALSE if error */ { #ifdef __WIN__ os_file_t file; @@ -991,25 +998,28 @@ Opens an existing file or creates a new. */ os_file_t os_file_create( /*===========*/ - /* out, own: handle to the file, not defined if error, - error number can be retrieved with - os_file_get_last_error */ - char* name, /* in: name of the file or path as a null-terminated - string */ - ulint create_mode, /* in: OS_FILE_OPEN if an existing file is opened - (if does not exist, error), or OS_FILE_CREATE if a new - file is created (if exists, error), OS_FILE_OVERWRITE - if a new is created or an old overwritten, - OS_FILE_OPEN_RAW, if a raw device or disk partition - should be opened */ - ulint purpose,/* in: OS_FILE_AIO, if asynchronous, non-buffered i/o - is desired, OS_FILE_NORMAL, if any normal file; - NOTE that it also depends on type, os_aio_.. and srv_.. - variables whether we really use async i/o or - unbuffered i/o: look in the function source code for - the exact rules */ - ulint type, /* in: OS_DATA_FILE or OS_LOG_FILE */ - ibool* success)/* out: TRUE if succeed, FALSE if error */ + /* out, own: handle to the file, not defined + if error, error number can be retrieved with + os_file_get_last_error */ + const char* name, /* in: name of the file or path as a + null-terminated string */ + ulint create_mode,/* in: OS_FILE_OPEN if an existing file + is opened (if does not exist, error), or + OS_FILE_CREATE if a new file is created + (if exists, error), + OS_FILE_OVERWRITE if a new file is created + or an old overwritten; + OS_FILE_OPEN_RAW, if a raw device or disk + partition should be opened */ + ulint purpose,/* in: OS_FILE_AIO, if asynchronous, + non-buffered i/o is desired, + OS_FILE_NORMAL, if any normal file; + NOTE that it also depends on type, os_aio_.. + and srv_.. variables whether we really use + async i/o or unbuffered i/o: look in the + function source code for the exact rules */ + ulint type, /* in: OS_DATA_FILE or OS_LOG_FILE */ + ibool* success)/* out: TRUE if succeed, FALSE if error */ { #ifdef __WIN__ os_file_t file; @@ -1202,8 +1212,8 @@ Deletes a file if it exists. The file has to be closed before calling this. */ ibool os_file_delete_if_exists( /*=====================*/ - /* out: TRUE if success */ - char* name) /* in: file path as a null-terminated string */ + /* out: TRUE if success */ + const char* name) /* in: file path as a null-terminated string */ { #ifdef __WIN__ BOOL ret; @@ -1263,8 +1273,8 @@ Deletes a file. The file has to be closed before calling this. */ ibool os_file_delete( /*===========*/ - /* out: TRUE if success */ - char* name) /* in: file path as a null-terminated string */ + /* out: TRUE if success */ + const char* name) /* in: file path as a null-terminated string */ { #ifdef __WIN__ BOOL ret; @@ -1327,9 +1337,9 @@ ibool os_file_rename( /*===========*/ /* out: TRUE if success */ - char* oldpath, /* in: old file path as a null-terminated + const char* oldpath,/* in: old file path as a null-terminated string */ - char* newpath) /* in: new file path */ + const char* newpath)/* in: new file path */ { #ifdef __WIN__ BOOL ret; @@ -1340,7 +1350,7 @@ os_file_rename( return(TRUE); } - os_file_handle_error(NULL, oldpath, "delete"); + os_file_handle_error(NULL, oldpath, "rename"); return(FALSE); #else @@ -1516,7 +1526,7 @@ ibool os_file_set_size( /*=============*/ /* out: TRUE if success */ - char* name, /* in: name of the file or path as a + const char* name, /* in: name of the file or path as a null-terminated string */ os_file_t file, /* in: handle to a file */ ulint size, /* in: least significant 32 bits of file @@ -1777,7 +1787,7 @@ os_file_pwrite( /*===========*/ /* out: number of bytes written, -1 if error */ os_file_t file, /* in: handle to a file */ - void* buf, /* in: buffer from where to write */ + const void* buf, /* in: buffer from where to write */ ulint n, /* in: number of bytes to write */ ulint offset, /* in: least significant 32 bits of file offset where to write */ @@ -2057,10 +2067,10 @@ os_file_write( /*==========*/ /* out: TRUE if request was successful, FALSE if fail */ - char* name, /* in: name of the file or path as a + const char* name, /* in: name of the file or path as a null-terminated string */ os_file_t file, /* in: handle to a file */ - void* buf, /* in: buffer from which to write */ + const void* buf, /* in: buffer from which to write */ ulint offset, /* in: least significant 32 bits of file offset where to write */ ulint offset_high, /* in: most significant 32 bits of @@ -2214,7 +2224,7 @@ ibool os_file_status( /*===========*/ /* out: TRUE if call succeeded */ - char* path, /* in: pathname of the file */ + const char* path, /* in: pathname of the file */ ibool* exists, /* out: TRUE if file exists */ os_file_type_t* type) /* out: type of the file (if it exists) */ { @@ -2319,7 +2329,7 @@ os_file_dirname( /*============*/ /* out, own: directory component of the pathname */ - char* path) /* in: pathname */ + const char* path) /* in: pathname */ { char* dir; int i, length, last_slash; @@ -2356,7 +2366,7 @@ os_file_create_subdirs_if_needed( /*=============================*/ /* out: TRUE if call succeeded FALSE otherwise */ - char* path) /* in: path name */ + const char* path) /* in: path name */ { char* subdir; static char rootdir[2] = { OS_FILE_PATH_SEPARATOR, 0 }; @@ -2753,7 +2763,7 @@ os_aio_array_reserve_slot( void* message2,/* in: message to be passed along with the aio operation */ os_file_t file, /* in: file handle */ - char* name, /* in: name of the file or path as a + const char* name, /* in: name of the file or path as a null-terminated string */ void* buf, /* in: buffer where to read or from which to write */ @@ -3000,7 +3010,7 @@ os_aio( because i/os are not actually handled until all have been posted: use with great caution! */ - char* name, /* in: name of the file or path as a + const char* name, /* in: name of the file or path as a null-terminated string */ os_file_t file, /* in: handle to a file */ void* buf, /* in: buffer where to read or from which @@ -3543,6 +3553,7 @@ consecutive_loop: if (n_consecutive == 1) { /* We can use the buffer of the i/o request */ combined_buf = slot->buf; + combined_buf2 = NULL; } else { combined_buf2 = ut_malloc(total_len + UNIV_PAGE_SIZE); @@ -3638,7 +3649,7 @@ consecutive_loop: } } - if (n_consecutive > 1) { + if (combined_buf2) { ut_free(combined_buf2); } diff --git a/innobase/os/os0sync.c b/innobase/os/os0sync.c index 7cbaf1f5123..c48c44a4c70 100644 --- a/innobase/os/os0sync.c +++ b/innobase/os/os0sync.c @@ -109,9 +109,9 @@ must be reset explicitly by calling sync_os_reset_event. */ os_event_t os_event_create( /*============*/ - /* out: the event handle */ - char* name) /* in: the name of the event, if NULL - the event is created without a name */ + /* out: the event handle */ + const char* name) /* in: the name of the event, if NULL + the event is created without a name */ { #ifdef __WIN__ os_event_t event; @@ -166,9 +166,9 @@ reset when a single thread is released. Works only in Windows. */ os_event_t os_event_create_auto( /*=================*/ - /* out: the event handle */ - char* name) /* in: the name of the event, if NULL - the event is created without a name */ + /* out: the event handle */ + const char* name) /* in: the name of the event, if NULL + the event is created without a name */ { os_event_t event; @@ -430,9 +430,9 @@ mutex semaphore of InnoDB itself (mutex_t) should be used where possible. */ os_mutex_t os_mutex_create( /*============*/ - /* out: the mutex handle */ - char* name) /* in: the name of the mutex, if NULL - the mutex is created without a name */ + /* out: the mutex handle */ + const char* name) /* in: the name of the mutex, if NULL + the mutex is created without a name */ { #ifdef __WIN__ HANDLE mutex; |