* Added r_str_concatch

* Fixed reflines libc issue
This commit is contained in:
Nibble 2009-04-06 14:01:56 +02:00
parent 5116358ce4
commit 1b61512a72
3 changed files with 12 additions and 8 deletions

View File

@ -197,7 +197,7 @@ int r_anal_reflines_str(struct r_anal_t *anal, struct r_anal_refline_t *list, ch
//C strcat(str, C_YELLOW);
if (anal->pc > ref->from && anal->pc < ref->to) {
if (ch=='-'||ch=='=')
sprintf(str, "%s%c", str, ch);
r_str_concatch(str, ch);
else
strcat(str, "|");
} else
@ -207,28 +207,29 @@ int r_anal_reflines_str(struct r_anal_t *anal, struct r_anal_refline_t *list, ch
cons_printf(C_WHITE"-");
else if (ch=='=')
cons_printf(C_YELLOW"=");
else sprintf(str, "%s%c", str, ch);
else {
r_str_concatch(str, ch);
}
} else
#endif
sprintf(str, "%s%c", str, ch);
r_str_concatch(str, ch);
} else {
//C strcat(str, C_WHITE);
/* up */
if (anal->pc < ref->from && anal->pc > ref->to) {
if (ch=='-'||ch=='=')
sprintf(str, "%s%c", str, ch);
r_str_concatch(str, ch);
else // ^
strcat(str, "|");
} else {
sprintf(str, "%s%c", str, ch);
}
} else
r_str_concatch(str, ch);
}
}
if (wide) {
switch(ch) {
case '=':
case '-':
sprintf(str, "%s%c", str, ch);
r_str_concatch(str, ch);
break;
default:
strcat(str, " ");

View File

@ -91,6 +91,7 @@ int r_str_escape(char *buf);
char *r_str_home(const char *str);
char *r_str_concat(char *ptr, const char *string);
char *r_str_concatf(char *ptr, const char *fmt, ...);
inline void r_str_concatch(char *x, char y);
/* hex */
int r_hex_pair2bin(const char *arg);

View File

@ -244,6 +244,8 @@ char *r_str_concatf(char *ptr, const char *fmt, ...)
return ptr;
}
inline void r_str_concatch(char *x, char y){char b[2]={y,0};strcat(x,b);}
void *r_str_free(void *ptr)
{
free (ptr);