defined MIO_EOL
This commit is contained in:
		| @ -1393,10 +1393,10 @@ static int log_oocs (mio_fmtout_t* fmtout, const mio_ooch_t* ptr, mio_oow_t len) | ||||
| 	{ | ||||
| 		/* the mask has changed. commit the buffered text */ | ||||
| /* TODO: HANDLE LINE ENDING CONVENTION BETTER... */ | ||||
| 		if (mio->log.ptr[mio->log.len - 1] != '\n') | ||||
| 		if (mio->log.ptr[mio->log.len - 1] != MIO_EOL) | ||||
| 		{ | ||||
| 			/* no line ending - append a line terminator */ | ||||
| 			mio->log.ptr[mio->log.len++] = '\n'; | ||||
| 			mio->log.ptr[mio->log.len++] = MIO_EOL; | ||||
| 		} | ||||
|  | ||||
| 		MIO_SYS_WRITE_LOG (mio, mio->log.last_mask, mio->log.ptr, mio->log.len); | ||||
| @ -1438,10 +1438,10 @@ redo: | ||||
| 			{ | ||||
| 				/* can't expand the buffer. just flush the existing contents */ | ||||
| 				/* TODO: HANDLE LINE ENDING CONVENTION BETTER... */ | ||||
| 				if (mio->log.ptr[mio->log.len - 1] != '\n') | ||||
| 				if (mio->log.ptr[mio->log.len - 1] != MIO_EOL) | ||||
| 				{ | ||||
| 					/* no line ending - append a line terminator */ | ||||
| 					mio->log.ptr[mio->log.len++] = '\n'; | ||||
| 					mio->log.ptr[mio->log.len++] = MIO_EOL; | ||||
| 				} | ||||
| 				MIO_SYS_WRITE_LOG (mio, mio->log.last_mask, mio->log.ptr, mio->log.len); | ||||
| 				mio->log.len = 0; | ||||
| @ -1555,7 +1555,7 @@ mio_ooi_t mio_logbfmtv (mio_t* mio, mio_bitmask_t mask, const mio_bch_t* fmt, va | ||||
|  | ||||
| 	x = fmt_outv(&fo, ap); | ||||
|  | ||||
| 	if (mio->log.len > 0 && mio->log.ptr[mio->log.len - 1] == '\n') | ||||
| 	if (mio->log.len > 0 && mio->log.ptr[mio->log.len - 1] == MIO_EOL) | ||||
| 	{ | ||||
| 		MIO_SYS_WRITE_LOG (mio, mio->log.last_mask, mio->log.ptr, mio->log.len); | ||||
| 		mio->log.len = 0; | ||||
| @ -1609,7 +1609,7 @@ mio_ooi_t mio_logufmtv (mio_t* mio, mio_bitmask_t mask, const mio_uch_t* fmt, va | ||||
|  | ||||
| 	x = fmt_outv(&fo, ap); | ||||
|  | ||||
| 	if (mio->log.len > 0 && mio->log.ptr[mio->log.len - 1] == '\n') | ||||
| 	if (mio->log.len > 0 && mio->log.ptr[mio->log.len - 1] == MIO_EOL) | ||||
| 	{ | ||||
| 		MIO_SYS_WRITE_LOG (mio, mio->log.last_mask, mio->log.ptr, mio->log.len); | ||||
| 		mio->log.len = 0; | ||||
|  | ||||
| @ -800,7 +800,7 @@ static int feed_json_data (mio_json_t* json, const mio_bch_t* data, mio_oow_t le | ||||
| 		c = *ptr++; | ||||
| 	#endif | ||||
|  | ||||
| 		if (c == '\n') | ||||
| 		if (c == MIO_EOL) | ||||
| 		{ | ||||
| 			json->c_col = 0; | ||||
| 			json->c_line++; | ||||
| @ -812,7 +812,7 @@ static int feed_json_data (mio_json_t* json, const mio_bch_t* data, mio_oow_t le | ||||
|  | ||||
| 		if (json->state_stack->in_comment)  | ||||
| 		{ | ||||
| 			if (c == '\n') json->state_stack->in_comment = 0; | ||||
| 			if (c == MIO_EOL) json->state_stack->in_comment = 0; | ||||
| 			continue; | ||||
| 		} | ||||
| 		if (json->state_stack->state == MIO_JSON_STATE_START && mio_is_ooch_space(c)) continue; /* skip white space */ | ||||
|  | ||||
| @ -588,6 +588,9 @@ struct mio_ntime_t | ||||
| #define MIO_COUNTOF(x) (sizeof(x) / sizeof(x[0])) | ||||
| #define MIO_BITSOF(x) (sizeof(x) * MIO_BITS_PER_BYTE) | ||||
|  | ||||
|  | ||||
| #define MIO_EOL ('\n') | ||||
|  | ||||
| /** | ||||
|  * The MIO_OFFSETOF() macro returns the offset of a field from the beginning | ||||
|  * of a structure. | ||||
|  | ||||
		Reference in New Issue
	
	Block a user