more appropriate functions.
+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
grub_size_t prefixlen;
char *rest;
char *linktarget;
+ grub_size_t linktarget_len;
*restart = 0;
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;
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);
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);
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)
{
*newstr = '\0';
if (num_found == 1)
- grub_strcat (ret, suffix);
+ grub_strcpy (newstr, suffix);
if (*ret == '\0')
{
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__