MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / map_init

Function map_init

extern/editline/src/map.c:890–933  ·  view source on GitHub ↗

map_init(): * Initialize and allocate the maps */

Source from the content-addressed store, hash-verified

888 * Initialize and allocate the maps
889 */
890protected int
891map_init(EditLine *el)
892{
893
894 /*
895 * Make sure those are correct before starting.
896 */
897#ifdef MAP_DEBUG
898 if (sizeof(el_map_emacs) != N_KEYS * sizeof(el_action_t))
899 EL_ABORT((el->errfile, "Emacs map incorrect\n"));
900 if (sizeof(el_map_vi_command) != N_KEYS * sizeof(el_action_t))
901 EL_ABORT((el->errfile, "Vi command map incorrect\n"));
902 if (sizeof(el_map_vi_insert) != N_KEYS * sizeof(el_action_t))
903 EL_ABORT((el->errfile, "Vi insert map incorrect\n"));
904#endif
905
906 el->el_map.alt = el_malloc(sizeof(*el->el_map.alt) * N_KEYS);
907 if (el->el_map.alt == NULL)
908 return -1;
909 el->el_map.key = el_malloc(sizeof(*el->el_map.key) * N_KEYS);
910 if (el->el_map.key == NULL)
911 return -1;
912 el->el_map.emacs = el_map_emacs;
913 el->el_map.vic = el_map_vi_command;
914 el->el_map.vii = el_map_vi_insert;
915 el->el_map.help = el_malloc(sizeof(*el->el_map.help) * EL_NUM_FCNS);
916 if (el->el_map.help == NULL)
917 return -1;
918 (void) memcpy(el->el_map.help, help__get(),
919 sizeof(*el->el_map.help) * EL_NUM_FCNS);
920 el->el_map.func = el_malloc(sizeof(*el->el_map.func) * EL_NUM_FCNS);
921 if (el->el_map.func == NULL)
922 return -1;
923 memcpy(el->el_map.func, func__get(), sizeof(*el->el_map.func)
924 * EL_NUM_FCNS);
925 el->el_map.nfunc = EL_NUM_FCNS;
926
927#ifdef VIDEFAULT
928 map_init_vi(el);
929#else
930 map_init_emacs(el);
931#endif /* VIDEFAULT */
932 return 0;
933}
934
935
936/* map_end():

Callers 1

el_init_fdFunction · 0.85

Calls 2

map_init_viFunction · 0.85
map_init_emacsFunction · 0.85

Tested by

no test coverage detected