Commit 32360605 authored by unknown's avatar unknown
Browse files

InnoDB: Remove warnings detected by GCC 4.0.0


innobase/fsp/fsp0fsp.c:
  Declare "first" in the scope where it is used, and add dummy return
  statement after ut_error to silence compiler warning.
innobase/include/dyn0dyn.h:
  Add const qualifier to dyn_push_string().
innobase/include/dyn0dyn.ic:
  dyn_push_string(): Add const qualifier to str;
  remove intermediate assignment.
innobase/include/mtr0log.h:
  mlog_write_string(), mlog_catenate_string(): Add const to str
innobase/log/log0log.c:
  Eliminate variables new_oldest and do_preflush in order to avoid
  warnings about possibly uninitialized variables.
  (new_oldest will now be declared in the scope of usage,
  and do_preflush == (advance != 0).)
innobase/log/log0recv.c:
  Remove warnings about uninitialized variables.
  Add UNIV_UNLIKELY() hints.
innobase/mtr/mtr0log.c:
  mlog_write_string(), mlog_catenate_string(): Add const to str
  mlog_write_string(): Add UNIV_UNLIKELY hints to assertion-like tests
innobase/row/row0sel.c:
  Remove warning about possibly uninitialized variable.
  (Always initialize *out_rec.)
parent 1eec421f
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -2325,7 +2325,6 @@ fseg_alloc_free_page_low(
	dulint		seg_id;
	ulint		used;
	ulint		reserved;
	fil_addr_t	first;
	xdes_t*		descr;		/* extent of the hinted page */
	ulint		ret_page;	/* the allocated page offset, FIL_NULL
					if could not be allocated */
@@ -2428,6 +2427,8 @@ fseg_alloc_free_page_low(
	} else if (reserved - used > 0) {
		/* 5. We take any unused page from the segment
		==============================================*/
		fil_addr_t	first;

		if (flst_get_len(seg_inode + FSEG_NOT_FULL, mtr) > 0) {
			first = flst_get_first(seg_inode + FSEG_NOT_FULL,
									mtr);
@@ -2435,6 +2436,7 @@ fseg_alloc_free_page_low(
			first = flst_get_first(seg_inode + FSEG_FREE, mtr);
		} else {
			ut_error;
			return(FIL_NULL);
		}

		ret_descr = xdes_lst_get_descriptor(space, first, mtr);
+1 −1
Original line number Diff line number Diff line
@@ -132,7 +132,7 @@ void
dyn_push_string(
/*============*/
	dyn_array_t*	arr,	/* in: dyn array */
	byte*		str,	/* in: string to write */
	const byte*	str,	/* in: string to write */
	ulint		len);	/* in: string length */

/*#################################################################*/
+2 −5
Original line number Diff line number Diff line
@@ -324,10 +324,9 @@ void
dyn_push_string(
/*============*/
	dyn_array_t*	arr,	/* in: dyn array */
	byte*		str,	/* in: string to write */
	const byte*	str,	/* in: string to write */
	ulint		len)	/* in: string length */
{
	byte*	ptr;
	ulint	n_copied;

	while (len > 0) {
@@ -337,9 +336,7 @@ dyn_push_string(
			n_copied = len;
		}			

		ptr = (byte*) dyn_array_push(arr, n_copied);

		ut_memcpy(ptr, str, n_copied);
		memcpy(dyn_array_push(arr, n_copied), str, n_copied);
		
		str += n_copied;
		len -= n_copied;
+7 −7
Original line number Diff line number Diff line
@@ -42,7 +42,7 @@ void
mlog_write_string(
/*==============*/
	byte*		ptr,	/* in: pointer where to write */
	byte*	str,	/* in: string to write */
	const byte*	str,	/* in: string to write */
	ulint		len,	/* in: string length */
	mtr_t*		mtr);	/* in: mini-transaction handle */
/************************************************************
@@ -86,7 +86,7 @@ void
mlog_catenate_string(
/*=================*/
	mtr_t*		mtr,	/* in: mtr */
	byte*	str,	/* in: string to write */
	const byte*	str,	/* in: string to write */
	ulint		len);	/* in: string length */
/************************************************************
Catenates a compressed ulint to mlog. */
+6 −15
Original line number Diff line number Diff line
@@ -2038,8 +2038,6 @@ log_checkpoint_margin(void)
	ulint	checkpoint_age;
	ulint	advance;
	dulint	oldest_lsn;
	dulint	new_oldest;
	ibool	do_preflush;
	ibool	sync;
	ibool	checkpoint_sync;
	ibool	do_checkpoint;
@@ -2047,7 +2045,6 @@ log_checkpoint_margin(void)
loop:
	sync = FALSE;
	checkpoint_sync = FALSE;
	do_preflush = FALSE;
	do_checkpoint = FALSE;

	mutex_enter(&(log->mutex));
@@ -2067,21 +2064,13 @@ log_checkpoint_margin(void)
		/* A flush is urgent: we have to do a synchronous preflush */

		sync = TRUE;
	
		advance = 2 * (age - log->max_modified_age_sync);

		new_oldest = ut_dulint_add(oldest_lsn, advance);

		do_preflush = TRUE;

		advance = 2 * (age - log->max_modified_age_async);
	} else if (age > log->max_modified_age_async) {

		/* A flush is not urgent: we do an asynchronous preflush */
		advance = age - log->max_modified_age_async;

		new_oldest = ut_dulint_add(oldest_lsn, advance);

		do_preflush = TRUE;
	} else {
		advance = 0;
	}

	checkpoint_age = ut_dulint_minus(log->lsn, log->last_checkpoint_lsn);
@@ -2105,7 +2094,9 @@ log_checkpoint_margin(void)
	
	mutex_exit(&(log->mutex));

	if (do_preflush) {
	if (advance) {
		dulint	new_oldest = ut_dulint_add(oldest_lsn, advance);

		success = log_preflush_pool_modified_pages(new_oldest, sync);

		/* If the flush succeeded, this thread has done its part
Loading