BB vi bug

walter harms wharms at bfs.de
Sat Jun 21 14:04:49 UTC 2008


Since text_hole_make() does not return NULL anymore this function can be simplified also;
btw: since text_hole_make(p,x) never changes p it could become void.


#if ENABLE_FEATURE_VI_YANKMARK \
 || (ENABLE_FEATURE_VI_COLON && ENABLE_FEATURE_VI_SEARCH) \
 || ENABLE_FEATURE_VI_CRASHME
static char *string_insert(char * p, char * s) // insert the string at 'p'
{
	int cnt, i;

	i = strlen(s);
	if (text_hole_make(p, i)) {
		strncpy(p, s, i);
		for (cnt = 0; *s != '\0'; s++) {
			if (*s == '\n')
				cnt++;
		}
#if ENABLE_FEATURE_VI_YANKMARK
		status_line("Put %d lines (%d chars) from [%c]", cnt, i, what_reg());
#endif
	}
	return p;
}
#endif


if ENABLE_FEATURE_VI_YANKMARK \
 || (ENABLE_FEATURE_VI_COLON && ENABLE_FEATURE_VI_SEARCH) \
 || ENABLE_FEATURE_VI_CRASHME
static char *string_insert(char * p, char * s) // insert the string at 'p'
{
	int cnt, i;

	i = strlen(s);
	text_hole_make(p, i)
	strncpy(p, s, i);
#if ENABLE_FEATURE_VI_YANKMARK
	{
		int cnt;
		for (cnt = 0; *s != '\0'; s++) {
			if (*s == '\n')
				cnt++;
		}
	}
#if ENABLE_FEATURE_VI_YANKMARK
		status_line("Put %d lines (%d chars) from [%c]", cnt, i, what_reg());
#endif
	
	return p;
}
#endif






More information about the busybox mailing list