Commit 5b3da95b authored by Michael Widenius's avatar Michael Widenius

Simplify fn_rext

- Change interface according to real usage
- Fix comment
- Rename to fn_frm_ext
parent 326bfb07
......@@ -685,7 +685,7 @@ int ha_partition::create(const char *name, TABLE *table_arg,
handler **file, **abort_file;
DBUG_ENTER("ha_partition::create");
DBUG_ASSERT(*fn_rext((char*)name) == '\0');
DBUG_ASSERT(!fn_frm_ext(name));
/* Not allowed to create temporary partitioned tables */
if (create_info && create_info->tmp_table())
......
......@@ -1725,8 +1725,7 @@ bool mysql_upgrade_db(THD *thd, LEX_CSTRING *old_db)
DBUG_PRINT("info",("Examining: %s", file->name));
/* skiping non-FRM files */
if (my_strcasecmp(files_charset_info,
(extension= fn_rext(file->name)), reg_ext))
if (!(extension= (char*) fn_frm_ext(file->name)))
continue;
/* A frm file found, add the table info rename list */
......
......@@ -217,31 +217,26 @@ static uchar *get_field_name(Field **buff, size_t *length,
Returns pointer to '.frm' extension of the file name.
SYNOPSIS
fn_rext()
fn_frm_ext()
name file name
DESCRIPTION
Checks file name part starting with the rightmost '.' character,
and returns it if it is equal to '.frm'.
TODO
It is a good idea to get rid of this function modifying the code
to garantee that the functions presently calling fn_rext() always
get arguments in the same format: either with '.frm' or without '.frm'.
RETURN VALUES
Pointer to the '.frm' extension. If there is no extension,
or extension is not '.frm', pointer at the end of file name.
Pointer to the '.frm' extension or NULL if not a .frm file
*/
char *fn_rext(char *name)
const char *fn_frm_ext(const char *name)
{
char *res= strrchr(name, '.');
const char *res= strrchr(name, '.');
if (res && !strcmp(res, reg_ext))
return res;
return name + strlen(name);
return 0;
}
TABLE_CATEGORY get_table_category(const LEX_CSTRING *db,
const LEX_CSTRING *name)
{
......
......@@ -2702,7 +2702,7 @@ ulong get_form_pos(File file, uchar *head, TYPELIB *save_names);
void append_unescaped(String *res, const char *pos, uint length);
void prepare_frm_header(THD *thd, uint reclength, uchar *fileinfo,
HA_CREATE_INFO *create_info, uint keys, KEY *key_info);
char *fn_rext(char *name);
const char *fn_frm_ext(const char *name);
/* Check that the integer is in the internal */
static inline int set_zone(int nr,int min_zone,int max_zone)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment