mirror of
https://github.com/MidnightCommander/mc
synced 2024-12-22 20:36:50 +03:00
lib/util.[ch]: removed unused functions.
str_unconst(), trim(), cstrstr() and cstrcasestr() are unused and removed. Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
parent
011b6670e2
commit
593157d8cb
66
lib/util.c
66
lib/util.c
@ -280,45 +280,6 @@ msglen (const char *text, int *lines, int *columns)
|
||||
*columns = ncolumns;
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
/**
|
||||
* Copy from s to d, and trim the beginning if necessary, and prepend
|
||||
* "..." in this case. The destination string can have at most len
|
||||
* bytes, not counting trailing 0.
|
||||
*/
|
||||
|
||||
char *
|
||||
trim (const char *s, char *d, int len)
|
||||
{
|
||||
int source_len;
|
||||
|
||||
/* Sanity check */
|
||||
len = max (len, 0);
|
||||
|
||||
source_len = strlen (s);
|
||||
if (source_len > len)
|
||||
{
|
||||
/* Cannot fit the whole line */
|
||||
if (len <= 3)
|
||||
{
|
||||
/* We only have room for the dots */
|
||||
memset (d, '.', len);
|
||||
d[len] = 0;
|
||||
return d;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Begin with ... and add the rest of the source string */
|
||||
memset (d, '.', 3);
|
||||
strcpy (d + 3, s + 3 + source_len - len);
|
||||
}
|
||||
}
|
||||
else
|
||||
/* We can copy the whole line */
|
||||
strcpy (d, s);
|
||||
return d;
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
/**
|
||||
* Quote the filename for the purpose of inserting it into the command
|
||||
@ -1526,33 +1487,6 @@ save_file_position (const char *filename, long line, long column, off_t offset,
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
extern const char *
|
||||
cstrcasestr (const char *haystack, const char *needle)
|
||||
{
|
||||
char *nee = str_create_search_needle (needle, 0);
|
||||
const char *result = str_search_first (haystack, nee, 0);
|
||||
str_release_search_needle (nee, 0);
|
||||
return result;
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
const char *
|
||||
cstrstr (const char *haystack, const char *needle)
|
||||
{
|
||||
return strstr (haystack, needle);
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
extern char *
|
||||
str_unconst (const char *s)
|
||||
{
|
||||
return (char *) s;
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
extern int
|
||||
ascii_alpha_to_cntrl (int ch)
|
||||
{
|
||||
|
16
lib/util.h
16
lib/util.h
@ -87,26 +87,10 @@ extern struct sigaction startup_handler;
|
||||
|
||||
/*** declarations of public functions ************************************************************/
|
||||
|
||||
/* Returns its argument as a "modifiable" string. This function is
|
||||
* intended to pass strings to legacy libraries that don't know yet
|
||||
* about the "const" modifier. The return value of this function
|
||||
* MUST NOT be modified. */
|
||||
extern char *str_unconst (const char *);
|
||||
|
||||
/* String managing functions */
|
||||
|
||||
extern const char *cstrcasestr (const char *haystack, const char *needle);
|
||||
extern const char *cstrstr (const char *haystack, const char *needle);
|
||||
|
||||
void str_replace (char *s, char from, char to);
|
||||
int is_printable (int c);
|
||||
void msglen (const char *text, /*@out@ */ int *lines, /*@out@ */ int *columns);
|
||||
|
||||
/* Copy from s to d, and trim the beginning if necessary, and prepend
|
||||
* "..." in this case. The destination string can have at most len
|
||||
* bytes, not counting trailing 0. */
|
||||
char *trim (const char *s, char *d, int len);
|
||||
|
||||
/* Quote the filename for the purpose of inserting it into the command
|
||||
* line. If quote_percent is 1, replace "%" with "%%" - the percent is
|
||||
* processed by the mc command line. */
|
||||
|
Loading…
Reference in New Issue
Block a user