* include/grub/misc.h (grub_strcat): Removed. All users changed to

more appropriate functions.
This commit is contained in:
Vladimir Serbinenko 2013-11-01 16:27:37 +01:00
parent fa9b3dcae2
commit e54b8f536b
6 changed files with 17 additions and 37 deletions

View file

@ -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>
* grub-core/kern/efi/efi.c (grub_efi_get_filename): Avoid inefficient

View file

@ -67,6 +67,7 @@ handle_symlink (struct grub_archelp_data *data,
grub_size_t prefixlen;
char *rest;
char *linktarget;
grub_size_t linktarget_len;
*restart = 0;
@ -96,7 +97,8 @@ handle_symlink (struct grub_archelp_data *data,
return grub_errno;
if (linktarget[0] == '\0')
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)
return grub_errno;
@ -121,7 +123,7 @@ handle_symlink (struct grub_archelp_data *data,
grub_memcpy (target, *name, prefixlen);
target[prefixlen-1] = '/';
}
grub_strcat (target, rest);
grub_strcpy (target + prefixlen + linktarget_len, rest);
grub_dprintf ("archelp", "symlink redirected %s to %s\n",
*name, target);
grub_free (*name);

View file

@ -137,23 +137,19 @@ static struct grub_video_bitmap *
try_loading_icon (grub_gfxmenu_icon_manager_t mgr,
const char *dir, const char *class_name)
{
char *path;
int l;
char *path, *ptr;
path = grub_malloc (grub_strlen (dir) + grub_strlen (class_name)
+ grub_strlen (icon_extension) + 3);
if (! path)
return 0;
grub_strcpy (path, dir);
l = grub_strlen (path);
if (path[l-1] != '/')
{
path[l] = '/';
path[l+1] = 0;
}
grub_strcat (path, class_name);
grub_strcat (path, icon_extension);
ptr = grub_stpcpy (path, dir);
if (path == ptr || ptr[-1] != '/')
*ptr++ = '/';
ptr = grub_stpcpy (ptr, class_name);
ptr = grub_stpcpy (ptr, icon_extension);
*ptr = '\0';
struct grub_video_bitmap *raw_bitmap;
grub_video_bitmap_load (&raw_bitmap, path);

View file

@ -87,12 +87,6 @@ strncpy (char *dest, const char *src, grub_size_t n)
return grub_strncpy (dest, src, n);
}
static inline char *
strcat (char *dest, const char *src)
{
return grub_strcat (dest, src);
}
static inline int
strcoll (const char *s1, const char *s2)
{

View file

@ -500,7 +500,7 @@ grub_normal_do_completion (char *buf, int *restore,
*newstr = '\0';
if (num_found == 1)
grub_strcat (ret, suffix);
grub_strcpy (newstr, suffix);
if (*ret == '\0')
{

View file

@ -87,23 +87,6 @@ grub_memcpy (void *dest, const void *src, grub_size_t 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. */
#ifndef GRUB_UTIL
#ifdef __APPLE__