mirror of
https://github.com/radareorg/radare2.git
synced 2025-03-04 12:27:40 +00:00
Optimize prefixline in cons/canvas
This commit is contained in:
parent
29311ec67e
commit
ea5740da57
@ -124,11 +124,13 @@ static int get_piece(const char *p, char *chr) {
|
|||||||
static char *prefixline(RConsCanvas *c, int *left) {
|
static char *prefixline(RConsCanvas *c, int *left) {
|
||||||
int x, len;
|
int x, len;
|
||||||
char *p;
|
char *p;
|
||||||
if (!c || strlen (c->b) < (c->y * c->w)) {
|
int b_len = c->w * c->h; //strlen (c->b); // correct optimization?
|
||||||
|
int yxw = c->y * c->w;
|
||||||
|
if (!c || b_len < yxw) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
p = c->b + (c->y * c->w);
|
p = c->b + yxw;
|
||||||
len = strlen (p) - 1;
|
len = b_len - yxw - 1;
|
||||||
for (x = 0; (p[x] && x < c->x) && x < len; x++) {
|
for (x = 0; (p[x] && x < c->x) && x < len; x++) {
|
||||||
if (p[x] == '\n') {
|
if (p[x] == '\n') {
|
||||||
p[x] = ' ';
|
p[x] = ' ';
|
||||||
|
Loading…
x
Reference in New Issue
Block a user