mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-09-23 14:51:27 +02:00
CLEANUP: patterns: get rid of pattern_data_setstring()
This function was only used to call chunk_init_len() from another chunk, which in the end consists in simply assigning the source chunk to the destination chunk. Let's remove this indirection to make the code clearer. Anyway it was the only place such a function was used.
This commit is contained in:
parent
5e6cc4aad8
commit
1ded605ad5
@ -115,14 +115,6 @@ static struct chunk *get_trash_chunk(void)
|
|||||||
return &trash_chunk;
|
return &trash_chunk;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* Used to set pattern data from a struct chunk, could be the trash struct chunk
|
|
||||||
*/
|
|
||||||
static void pattern_data_setstring(union pattern_data *data, struct chunk *c)
|
|
||||||
{
|
|
||||||
chunk_initlen(&data->str, c->str, c->size, c->len);
|
|
||||||
}
|
|
||||||
|
|
||||||
/******************************************************************/
|
/******************************************************************/
|
||||||
/* Pattern casts functions */
|
/* Pattern casts functions */
|
||||||
/******************************************************************/
|
/******************************************************************/
|
||||||
@ -141,7 +133,7 @@ static int c_ip2str(union pattern_data *data)
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
trash->len = strlen(trash->str);
|
trash->len = strlen(trash->str);
|
||||||
pattern_data_setstring(data, trash);
|
data->str = *trash;
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -160,8 +152,7 @@ static int c_ipv62str(union pattern_data *data)
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
trash->len = strlen(trash->str);
|
trash->len = strlen(trash->str);
|
||||||
pattern_data_setstring(data, trash);
|
data->str = *trash;
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -203,9 +194,7 @@ static int c_int2str(union pattern_data *data)
|
|||||||
trash->size = trash->size - (pos - trash->str);
|
trash->size = trash->size - (pos - trash->str);
|
||||||
trash->str = pos;
|
trash->str = pos;
|
||||||
trash->len = strlen(pos);
|
trash->len = strlen(pos);
|
||||||
|
data->str = *trash;
|
||||||
pattern_data_setstring(data, trash);
|
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -215,9 +204,7 @@ static int c_datadup(union pattern_data *data)
|
|||||||
|
|
||||||
trash->len = data->str.len < trash->size ? data->str.len : trash->size;
|
trash->len = data->str.len < trash->size ? data->str.len : trash->size;
|
||||||
memcpy(trash->str, data->str.str, trash->len);
|
memcpy(trash->str, data->str.str, trash->len);
|
||||||
|
data->str = *trash;
|
||||||
pattern_data_setstring(data, trash);
|
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user