mirror of
https://github.com/vim/vim.git
synced 2025-09-25 03:54:15 -04:00
patch 8.0.0075
Problem: Using number for exception type lacks type checking. Solution: Use an enum.
This commit is contained in:
@@ -1388,8 +1388,6 @@ do_cmdline(
|
|||||||
break;
|
break;
|
||||||
case ET_INTERRUPT:
|
case ET_INTERRUPT:
|
||||||
break;
|
break;
|
||||||
default:
|
|
||||||
p = vim_strsave((char_u *)_(e_internal));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
saved_sourcing_name = sourcing_name;
|
saved_sourcing_name = sourcing_name;
|
||||||
|
@@ -16,7 +16,7 @@
|
|||||||
#if defined(FEAT_EVAL) || defined(PROTO)
|
#if defined(FEAT_EVAL) || defined(PROTO)
|
||||||
|
|
||||||
static void free_msglist(struct msglist *l);
|
static void free_msglist(struct msglist *l);
|
||||||
static int throw_exception(void *, int, char_u *);
|
static int throw_exception(void *, except_type_T, char_u *);
|
||||||
static char_u *get_end_emsg(struct condstack *cstack);
|
static char_u *get_end_emsg(struct condstack *cstack);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -422,7 +422,7 @@ do_intthrow(struct condstack *cstack)
|
|||||||
char_u *
|
char_u *
|
||||||
get_exception_string(
|
get_exception_string(
|
||||||
void *value,
|
void *value,
|
||||||
int type,
|
except_type_T type,
|
||||||
char_u *cmdname,
|
char_u *cmdname,
|
||||||
int *should_free)
|
int *should_free)
|
||||||
{
|
{
|
||||||
@@ -503,7 +503,7 @@ get_exception_string(
|
|||||||
* error exception.
|
* error exception.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
throw_exception(void *value, int type, char_u *cmdname)
|
throw_exception(void *value, except_type_T type, char_u *cmdname)
|
||||||
{
|
{
|
||||||
except_T *excp;
|
except_T *excp;
|
||||||
int should_free;
|
int should_free;
|
||||||
|
@@ -7,7 +7,7 @@ int cause_errthrow(char_u *mesg, int severe, int *ignore);
|
|||||||
void free_global_msglist(void);
|
void free_global_msglist(void);
|
||||||
void do_errthrow(struct condstack *cstack, char_u *cmdname);
|
void do_errthrow(struct condstack *cstack, char_u *cmdname);
|
||||||
int do_intthrow(struct condstack *cstack);
|
int do_intthrow(struct condstack *cstack);
|
||||||
char_u *get_exception_string(void *value, int type, char_u *cmdname, int *should_free);
|
char_u *get_exception_string(void *value, except_type_T type, char_u *cmdname, int *should_free);
|
||||||
void discard_current_exception(void);
|
void discard_current_exception(void);
|
||||||
void report_make_pending(int pending, void *value);
|
void report_make_pending(int pending, void *value);
|
||||||
void report_resume_pending(int pending, void *value);
|
void report_resume_pending(int pending, void *value);
|
||||||
|
@@ -814,6 +814,16 @@ struct msglist
|
|||||||
struct msglist *next; /* next of several messages in a row */
|
struct msglist *next; /* next of several messages in a row */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The exception types.
|
||||||
|
*/
|
||||||
|
typedef enum
|
||||||
|
{
|
||||||
|
ET_USER, /* exception caused by ":throw" command */
|
||||||
|
ET_ERROR, /* error exception */
|
||||||
|
ET_INTERRUPT /* interrupt exception triggered by Ctrl-C */
|
||||||
|
} except_type_T;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Structure describing an exception.
|
* Structure describing an exception.
|
||||||
* (don't use "struct exception", it's used by the math library).
|
* (don't use "struct exception", it's used by the math library).
|
||||||
@@ -821,7 +831,7 @@ struct msglist
|
|||||||
typedef struct vim_exception except_T;
|
typedef struct vim_exception except_T;
|
||||||
struct vim_exception
|
struct vim_exception
|
||||||
{
|
{
|
||||||
int type; /* exception type */
|
except_type_T type; /* exception type */
|
||||||
char_u *value; /* exception value */
|
char_u *value; /* exception value */
|
||||||
struct msglist *messages; /* message(s) causing error exception */
|
struct msglist *messages; /* message(s) causing error exception */
|
||||||
char_u *throw_name; /* name of the throw point */
|
char_u *throw_name; /* name of the throw point */
|
||||||
@@ -829,13 +839,6 @@ struct vim_exception
|
|||||||
except_T *caught; /* next exception on the caught stack */
|
except_T *caught; /* next exception on the caught stack */
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
|
||||||
* The exception types.
|
|
||||||
*/
|
|
||||||
#define ET_USER 0 /* exception caused by ":throw" command */
|
|
||||||
#define ET_ERROR 1 /* error exception */
|
|
||||||
#define ET_INTERRUPT 2 /* interrupt exception triggered by Ctrl-C */
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Structure to save the error/interrupt/exception state between calls to
|
* Structure to save the error/interrupt/exception state between calls to
|
||||||
* enter_cleanup() and leave_cleanup(). Must be allocated as an automatic
|
* enter_cleanup() and leave_cleanup(). Must be allocated as an automatic
|
||||||
|
@@ -764,6 +764,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
75,
|
||||||
/**/
|
/**/
|
||||||
74,
|
74,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user