- if( i_data <= 0 ) /* No data */
- goto exit;
-
- /* See if there is a '\n' */
- psz_lf = memchr( p_data, '\n', __MAX( i_data - 1, 1 ) );
- psz_cr = memchr( p_data, '\r', __MAX( i_data - 1, 1 ) );
-
- if( psz_lf && !psz_cr && p_data[i_data-1] == '\r' )
- {
- psz_cr = &p_data[i_data-1];
- }
- if( psz_cr && !psz_lf && p_data[i_data-1] == '\n' )
- {
- psz_lf = &p_data[i_data-1];
- }
-
- if( psz_lf || psz_cr )
+ /* Check if there is an EOL */
+ if( ( psz_eol = memchr( p_data, '\n', i_data ) ) )