Skip to content

Commit b4683ed

Browse files
PaulFurtadophdru
authored andcommitted
Remove variable declaration from for-loop header and enclose in block
This solves `error: for loop initial declarations are only allowed in C99 mode` when building on gcc 4.4.7 (Default gcc on CentOS 6.x)
1 parent 29da887 commit b4683ed

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

oursqlx/_exceptions.c

+4-1
Original file line numberDiff line numberDiff line change
@@ -618,7 +618,9 @@ enum _oursqlx_exception_type _oursqlx_exc_from_errno(int err) {
618618

619619
default:
620620
#if MYSQL_VERSION_ID >= 50700
621-
for(unsigned int i = 0; i < sizeof(errmsg_section_start)/sizeof(int); ++i) {
621+
{
622+
unsigned int i;
623+
for(i = 0; i < sizeof(errmsg_section_start)/sizeof(int); ++i) {
622624
int min = errmsg_section_start[i];
623625
int max = errmsg_section_start[i] + errmsg_section_size[i] - 1;
624626
if ( err >= min && err <= max ) {
@@ -628,6 +630,7 @@ enum _oursqlx_exception_type _oursqlx_exc_from_errno(int err) {
628630
if ( err > CR_MIN_ERROR && err < CR_MAX_ERROR) {
629631
return _oursqlx_InterfaceError;
630632
}
633+
}
631634
#else
632635
if (err >= ER_ERROR_FIRST && err <= ER_ERROR_LAST)
633636
return _oursqlx_ProgrammingError;

0 commit comments

Comments
 (0)