forked from len0rd/rockbox
Use the strrsplt function in one more place
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15662 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
940fe31f81
commit
4acae4da03
4 changed files with 19 additions and 20 deletions
|
@ -508,22 +508,6 @@ static int buffer_bookmarks(struct bookmark_list* bookmarks, int first_line)
|
||||||
return bookmarks->start + bookmarks->count;
|
return bookmarks->start + bookmarks->count;
|
||||||
}
|
}
|
||||||
|
|
||||||
static char* strrsplt(char* str, int c)
|
|
||||||
{
|
|
||||||
char* s = strrchr(str, c);
|
|
||||||
|
|
||||||
if (s != NULL)
|
|
||||||
{
|
|
||||||
*s++ = '\0';
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
s = str;
|
|
||||||
}
|
|
||||||
|
|
||||||
return s;
|
|
||||||
}
|
|
||||||
|
|
||||||
static char* get_bookmark_info(int list_index, void* data, char *buffer)
|
static char* get_bookmark_info(int list_index, void* data, char *buffer)
|
||||||
{
|
{
|
||||||
struct bookmark_list* bookmarks = (struct bookmark_list*) data;
|
struct bookmark_list* bookmarks = (struct bookmark_list*) data;
|
||||||
|
|
16
apps/misc.c
16
apps/misc.c
|
@ -1076,3 +1076,19 @@ int hex_to_rgb(const char* hex)
|
||||||
}
|
}
|
||||||
#endif /* HAVE_LCD_COLOR */
|
#endif /* HAVE_LCD_COLOR */
|
||||||
|
|
||||||
|
char* strrsplt(char* str, int c)
|
||||||
|
{
|
||||||
|
char* s = strrchr(str, c);
|
||||||
|
|
||||||
|
if (s != NULL)
|
||||||
|
{
|
||||||
|
*s++ = '\0';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
s = str;
|
||||||
|
}
|
||||||
|
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -113,4 +113,6 @@ void setvol(void);
|
||||||
int hex_to_rgb(const char* hex);
|
int hex_to_rgb(const char* hex);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
char* strrsplt(char* str, int c);
|
||||||
|
|
||||||
#endif /* MISC_H */
|
#endif /* MISC_H */
|
||||||
|
|
|
@ -372,10 +372,7 @@ static void format_name(char* dest, const char* src)
|
||||||
strcpy(dest, p+1);
|
strcpy(dest, p+1);
|
||||||
|
|
||||||
/* Remove the extension */
|
/* Remove the extension */
|
||||||
char* q = strrchr(dest, '.');
|
strrsplt(dest, '.');
|
||||||
|
|
||||||
if (q != NULL)
|
|
||||||
*q = '\0';
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue