Pointer arithmetic

Signed-off-by: tyrolyean <tyrolyean@tyrolyean.net>
This commit is contained in:
tyrolyean 2020-05-01 01:58:01 +02:00
parent 9d7f1a1779
commit 09f4d8d360
No known key found for this signature in database
GPG Key ID: EDD105663B707C62
1 changed files with 3 additions and 3 deletions

View File

@ -214,13 +214,13 @@ const char* get_next_line(const char* message, size_t len){
* the left.
*/
const char* get_prev_line(const char* message, size_t len_neg){
for(size_t i = 0; i < len_neg-2; i++){
for(size_t i = 0; i < (len_neg-2); i++){
if(message[-i] == '\n'){
if(message[-(i+1)] == '\r'){
return &message[-(i+2)];
return message-(i+2);
}else{
return &message[-(i+2)];
return message-(i+1);
}
}