mirror of
				https://github.com/tmux/tmux.git
				synced 2025-11-04 00:56:10 +00:00 
			
		
		
		
	Sprinkle a little more const.
This commit is contained in:
		
							
								
								
									
										10
									
								
								mode-key.c
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								mode-key.c
									
									
									
									
									
								
							@@ -40,7 +40,7 @@
 | 
				
			|||||||
 */
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* Edit keys command strings. */
 | 
					/* Edit keys command strings. */
 | 
				
			||||||
struct mode_key_cmdstr mode_key_cmdstr_edit[] = {
 | 
					const struct mode_key_cmdstr mode_key_cmdstr_edit[] = {
 | 
				
			||||||
	{ MODEKEYEDIT_BACKSPACE, "backspace" },
 | 
						{ MODEKEYEDIT_BACKSPACE, "backspace" },
 | 
				
			||||||
	{ MODEKEYEDIT_CANCEL, "cancel" },
 | 
						{ MODEKEYEDIT_CANCEL, "cancel" },
 | 
				
			||||||
	{ MODEKEYEDIT_COMPLETE, "complete" },
 | 
						{ MODEKEYEDIT_COMPLETE, "complete" },
 | 
				
			||||||
@@ -63,7 +63,7 @@ struct mode_key_cmdstr mode_key_cmdstr_edit[] = {
 | 
				
			|||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* Choice keys command strings. */
 | 
					/* Choice keys command strings. */
 | 
				
			||||||
struct mode_key_cmdstr mode_key_cmdstr_choice[] = {
 | 
					const struct mode_key_cmdstr mode_key_cmdstr_choice[] = {
 | 
				
			||||||
	{ MODEKEYCHOICE_CANCEL, "cancel" },
 | 
						{ MODEKEYCHOICE_CANCEL, "cancel" },
 | 
				
			||||||
	{ MODEKEYCHOICE_CHOOSE, "choose" },
 | 
						{ MODEKEYCHOICE_CHOOSE, "choose" },
 | 
				
			||||||
	{ MODEKEYCHOICE_DOWN, "down" },
 | 
						{ MODEKEYCHOICE_DOWN, "down" },
 | 
				
			||||||
@@ -77,7 +77,7 @@ struct mode_key_cmdstr mode_key_cmdstr_choice[] = {
 | 
				
			|||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* Copy keys command strings. */
 | 
					/* Copy keys command strings. */
 | 
				
			||||||
struct mode_key_cmdstr mode_key_cmdstr_copy[] = {
 | 
					const struct mode_key_cmdstr mode_key_cmdstr_copy[] = {
 | 
				
			||||||
	{ MODEKEYCOPY_BACKTOINDENTATION, "back-to-indentation" },
 | 
						{ MODEKEYCOPY_BACKTOINDENTATION, "back-to-indentation" },
 | 
				
			||||||
	{ MODEKEYCOPY_BOTTOMLINE, "bottom-line" },
 | 
						{ MODEKEYCOPY_BOTTOMLINE, "bottom-line" },
 | 
				
			||||||
	{ MODEKEYCOPY_CANCEL, "cancel" },
 | 
						{ MODEKEYCOPY_CANCEL, "cancel" },
 | 
				
			||||||
@@ -384,7 +384,7 @@ mode_key_cmp(struct mode_key_binding *mbind1, struct mode_key_binding *mbind2)
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const char *
 | 
					const char *
 | 
				
			||||||
mode_key_tostring(struct mode_key_cmdstr *cmdstr, enum mode_key_cmd cmd)
 | 
					mode_key_tostring(const struct mode_key_cmdstr *cmdstr, enum mode_key_cmd cmd)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	for (; cmdstr->name != NULL; cmdstr++) {
 | 
						for (; cmdstr->name != NULL; cmdstr++) {
 | 
				
			||||||
		if (cmdstr->cmd == cmd)
 | 
							if (cmdstr->cmd == cmd)
 | 
				
			||||||
@@ -394,7 +394,7 @@ mode_key_tostring(struct mode_key_cmdstr *cmdstr, enum mode_key_cmd cmd)
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
enum mode_key_cmd
 | 
					enum mode_key_cmd
 | 
				
			||||||
mode_key_fromstring(struct mode_key_cmdstr *cmdstr, const char *name)
 | 
					mode_key_fromstring(const struct mode_key_cmdstr *cmdstr, const char *name)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	for (; cmdstr->name != NULL; cmdstr++) {
 | 
						for (; cmdstr->name != NULL; cmdstr++) {
 | 
				
			||||||
		if (strcasecmp(cmdstr->name, name) == 0)
 | 
							if (strcasecmp(cmdstr->name, name) == 0)
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										14
									
								
								tmux.h
									
									
									
									
									
								
							
							
						
						
									
										14
									
								
								tmux.h
									
									
									
									
									
								
							@@ -534,10 +534,10 @@ struct mode_key_cmdstr {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
/* Named mode key table description. */
 | 
					/* Named mode key table description. */
 | 
				
			||||||
struct mode_key_table {
 | 
					struct mode_key_table {
 | 
				
			||||||
	const char		*name;
 | 
						const char			*name;
 | 
				
			||||||
	struct mode_key_cmdstr	*cmdstr;
 | 
						const struct mode_key_cmdstr	*cmdstr;
 | 
				
			||||||
	struct mode_key_tree	*tree;
 | 
						struct mode_key_tree		*tree;
 | 
				
			||||||
	const struct mode_key_entry *table;	/* default entries */
 | 
						const struct mode_key_entry	*table;	/* default entries */
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* Modes. */
 | 
					/* Modes. */
 | 
				
			||||||
@@ -1329,8 +1329,10 @@ extern struct mode_key_tree mode_key_tree_emacs_choice;
 | 
				
			|||||||
extern struct mode_key_tree mode_key_tree_emacs_copy;
 | 
					extern struct mode_key_tree mode_key_tree_emacs_copy;
 | 
				
			||||||
int	mode_key_cmp(struct mode_key_binding *, struct mode_key_binding *);
 | 
					int	mode_key_cmp(struct mode_key_binding *, struct mode_key_binding *);
 | 
				
			||||||
SPLAY_PROTOTYPE(mode_key_tree, mode_key_binding, entry, mode_key_cmp);
 | 
					SPLAY_PROTOTYPE(mode_key_tree, mode_key_binding, entry, mode_key_cmp);
 | 
				
			||||||
const char *mode_key_tostring(struct mode_key_cmdstr *r, enum mode_key_cmd);
 | 
					const char *mode_key_tostring(const struct mode_key_cmdstr *,
 | 
				
			||||||
enum mode_key_cmd mode_key_fromstring(struct mode_key_cmdstr *, const char *);
 | 
						    enum mode_key_cmd);
 | 
				
			||||||
 | 
					enum mode_key_cmd mode_key_fromstring(const struct mode_key_cmdstr *,
 | 
				
			||||||
 | 
						    const char *);
 | 
				
			||||||
const struct mode_key_table *mode_key_findtable(const char *);
 | 
					const struct mode_key_table *mode_key_findtable(const char *);
 | 
				
			||||||
void	mode_key_init_trees(void);
 | 
					void	mode_key_init_trees(void);
 | 
				
			||||||
void	mode_key_init(struct mode_key_data *, struct mode_key_tree *);
 | 
					void	mode_key_init(struct mode_key_data *, struct mode_key_tree *);
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user