* include/grub/misc.h (grub_strcat): Removed. All users changed to
more appropriate functions.
This commit is contained in:
parent
fa9b3dcae2
commit
e54b8f536b
6 changed files with 17 additions and 37 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
2013-11-01 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
|
* include/grub/misc.h (grub_strcat): Removed. All users changed to
|
||||||
|
more appropriate functions.
|
||||||
|
|
||||||
2013-11-01 Vladimir Serbinenko <phcoder@gmail.com>
|
2013-11-01 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
* grub-core/kern/efi/efi.c (grub_efi_get_filename): Avoid inefficient
|
* grub-core/kern/efi/efi.c (grub_efi_get_filename): Avoid inefficient
|
||||||
|
|
|
@ -67,6 +67,7 @@ handle_symlink (struct grub_archelp_data *data,
|
||||||
grub_size_t prefixlen;
|
grub_size_t prefixlen;
|
||||||
char *rest;
|
char *rest;
|
||||||
char *linktarget;
|
char *linktarget;
|
||||||
|
grub_size_t linktarget_len;
|
||||||
|
|
||||||
*restart = 0;
|
*restart = 0;
|
||||||
|
|
||||||
|
@ -96,7 +97,8 @@ handle_symlink (struct grub_archelp_data *data,
|
||||||
return grub_errno;
|
return grub_errno;
|
||||||
if (linktarget[0] == '\0')
|
if (linktarget[0] == '\0')
|
||||||
return GRUB_ERR_NONE;
|
return GRUB_ERR_NONE;
|
||||||
target = grub_malloc (grub_strlen (linktarget) + grub_strlen (*name) + 2);
|
linktarget_len = grub_strlen (linktarget);
|
||||||
|
target = grub_malloc (linktarget_len + grub_strlen (*name) + 2);
|
||||||
if (!target)
|
if (!target)
|
||||||
return grub_errno;
|
return grub_errno;
|
||||||
|
|
||||||
|
@ -121,7 +123,7 @@ handle_symlink (struct grub_archelp_data *data,
|
||||||
grub_memcpy (target, *name, prefixlen);
|
grub_memcpy (target, *name, prefixlen);
|
||||||
target[prefixlen-1] = '/';
|
target[prefixlen-1] = '/';
|
||||||
}
|
}
|
||||||
grub_strcat (target, rest);
|
grub_strcpy (target + prefixlen + linktarget_len, rest);
|
||||||
grub_dprintf ("archelp", "symlink redirected %s to %s\n",
|
grub_dprintf ("archelp", "symlink redirected %s to %s\n",
|
||||||
*name, target);
|
*name, target);
|
||||||
grub_free (*name);
|
grub_free (*name);
|
||||||
|
|
|
@ -137,23 +137,19 @@ static struct grub_video_bitmap *
|
||||||
try_loading_icon (grub_gfxmenu_icon_manager_t mgr,
|
try_loading_icon (grub_gfxmenu_icon_manager_t mgr,
|
||||||
const char *dir, const char *class_name)
|
const char *dir, const char *class_name)
|
||||||
{
|
{
|
||||||
char *path;
|
char *path, *ptr;
|
||||||
int l;
|
|
||||||
|
|
||||||
path = grub_malloc (grub_strlen (dir) + grub_strlen (class_name)
|
path = grub_malloc (grub_strlen (dir) + grub_strlen (class_name)
|
||||||
+ grub_strlen (icon_extension) + 3);
|
+ grub_strlen (icon_extension) + 3);
|
||||||
if (! path)
|
if (! path)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
grub_strcpy (path, dir);
|
ptr = grub_stpcpy (path, dir);
|
||||||
l = grub_strlen (path);
|
if (path == ptr || ptr[-1] != '/')
|
||||||
if (path[l-1] != '/')
|
*ptr++ = '/';
|
||||||
{
|
ptr = grub_stpcpy (ptr, class_name);
|
||||||
path[l] = '/';
|
ptr = grub_stpcpy (ptr, icon_extension);
|
||||||
path[l+1] = 0;
|
*ptr = '\0';
|
||||||
}
|
|
||||||
grub_strcat (path, class_name);
|
|
||||||
grub_strcat (path, icon_extension);
|
|
||||||
|
|
||||||
struct grub_video_bitmap *raw_bitmap;
|
struct grub_video_bitmap *raw_bitmap;
|
||||||
grub_video_bitmap_load (&raw_bitmap, path);
|
grub_video_bitmap_load (&raw_bitmap, path);
|
||||||
|
|
|
@ -87,12 +87,6 @@ strncpy (char *dest, const char *src, grub_size_t n)
|
||||||
return grub_strncpy (dest, src, n);
|
return grub_strncpy (dest, src, n);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline char *
|
|
||||||
strcat (char *dest, const char *src)
|
|
||||||
{
|
|
||||||
return grub_strcat (dest, src);
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline int
|
static inline int
|
||||||
strcoll (const char *s1, const char *s2)
|
strcoll (const char *s1, const char *s2)
|
||||||
{
|
{
|
||||||
|
|
|
@ -500,7 +500,7 @@ grub_normal_do_completion (char *buf, int *restore,
|
||||||
*newstr = '\0';
|
*newstr = '\0';
|
||||||
|
|
||||||
if (num_found == 1)
|
if (num_found == 1)
|
||||||
grub_strcat (ret, suffix);
|
grub_strcpy (newstr, suffix);
|
||||||
|
|
||||||
if (*ret == '\0')
|
if (*ret == '\0')
|
||||||
{
|
{
|
||||||
|
|
|
@ -87,23 +87,6 @@ grub_memcpy (void *dest, const void *src, grub_size_t n)
|
||||||
return grub_memmove (dest, src, n);
|
return grub_memmove (dest, src, n);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline char *
|
|
||||||
grub_strcat (char *dest, const char *src)
|
|
||||||
{
|
|
||||||
char *p = dest;
|
|
||||||
|
|
||||||
while (*p)
|
|
||||||
p++;
|
|
||||||
|
|
||||||
while ((*p = *src) != '\0')
|
|
||||||
{
|
|
||||||
p++;
|
|
||||||
src++;
|
|
||||||
}
|
|
||||||
|
|
||||||
return dest;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Prototypes for aliases. */
|
/* Prototypes for aliases. */
|
||||||
#ifndef GRUB_UTIL
|
#ifndef GRUB_UTIL
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
|
|
Loading…
Reference in a new issue