Introduction
Introduction Statistics Contact Development Disclaimer Help
Fall back to the default latin composition table. - sam - An updated version of…
git clone git://vernunftzentrum.de/sam.git
Log
Files
Refs
LICENSE
---
commit 613a36b923aee53922ad62bbf78a0023c229af75
parent c39a4076c24b965ae6d99a9cca2a01a014e109eb
Author: Rob King <[email protected]>
Date: Thu, 11 Aug 2016 23:23:12 -0500
Fall back to the default latin composition table.
Diffstat:
libXg/latin1.c | 30 +++++++++++++++---------------
1 file changed, 15 insertions(+), 15 deletions(-)
---
diff --git a/libXg/latin1.c b/libXg/latin1.c
@@ -226,6 +226,7 @@ struct latin latintab[] = {
0, 0,
};
+
struct latin *mappings = NULL;
void
@@ -237,6 +238,10 @@ freelatin(void)
void
initlatin(void)
{
+ mappings = calloc(MAPPING_MAX + 1, sizeof(struct latin));
+ if (mappings)
+ atexit(freelatin);
+
FILE *keyboard = NULL;
if (getenv("HOME")){
char path[1024] = {0};
@@ -244,17 +249,8 @@ initlatin(void)
keyboard = fopen(path, "r");
}
- if (!keyboard){
- mappings = latintab;
- return;
- }
-
- mappings = calloc(MAPPING_MAX + 1, sizeof(struct latin));
- if (!mappings){
- mappings = latintab;
- fclose(keyboard);
- return;
- }
+ if (!keyboard)
+ return;
int j = 0;
while (j < MAPPING_MAX){
@@ -269,7 +265,6 @@ initlatin(void)
}
fclose(keyboard);
- atexit(freelatin);
}
long
@@ -277,9 +272,14 @@ latin1(unsigned char *k)
{
struct latin *l;
- for(l=mappings; l->l; l++)
- if(k[0]==l->c[0] && k[1]==l->c[1])
- return l->l;
+ for (l = mappings; l->l; l++)
+ if (k[0] == l->c[0] && k[1] == l->c[1])
+ return l->l;
+
+ for (l = latintab; l->l; l++)
+ if (k[0] == l->c[0] && k[1] == l->c[1])
+ return l->l;
+
return -1;
}
You are viewing proxied material from vernunftzentrum.de. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.