summaryrefslogtreecommitdiff
path: root/Build/source/texk/web2c/luatexdir/lang
diff options
context:
space:
mode:
authorPeter Breitenlohner <peb@mppmu.mpg.de>2010-01-25 12:30:04 +0000
committerPeter Breitenlohner <peb@mppmu.mpg.de>2010-01-25 12:30:04 +0000
commit65c37b17f39210ff32ba3ec1415d5f5a3f8e86ff (patch)
treea23710d061b8695f9eec30cbf5591e6016432089 /Build/source/texk/web2c/luatexdir/lang
parenta6ff9d2b253991c7c8eb94f2977abb10ad466480 (diff)
texk/web2c/luatexdir: compiler warnings
git-svn-id: svn://tug.org/texlive/trunk@16817 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/web2c/luatexdir/lang')
-rw-r--r--Build/source/texk/web2c/luatexdir/lang/hnjalloc.c2
-rw-r--r--Build/source/texk/web2c/luatexdir/lang/hyphen.c20
-rw-r--r--Build/source/texk/web2c/luatexdir/lang/texlang.c47
3 files changed, 36 insertions, 33 deletions
diff --git a/Build/source/texk/web2c/luatexdir/lang/hnjalloc.c b/Build/source/texk/web2c/luatexdir/lang/hnjalloc.c
index 59d62e2aabb..6072152f4f5 100644
--- a/Build/source/texk/web2c/luatexdir/lang/hnjalloc.c
+++ b/Build/source/texk/web2c/luatexdir/lang/hnjalloc.c
@@ -38,6 +38,8 @@
#include <stdlib.h>
#include <stdio.h>
+#include "hnjalloc.h"
+
void *
hnj_malloc (int size)
{
diff --git a/Build/source/texk/web2c/luatexdir/lang/hyphen.c b/Build/source/texk/web2c/luatexdir/lang/hyphen.c
index 56d745809ae..edcad69adff 100644
--- a/Build/source/texk/web2c/luatexdir/lang/hyphen.c
+++ b/Build/source/texk/web2c/luatexdir/lang/hyphen.c
@@ -63,7 +63,7 @@ static unsigned char * hnj_strdup(
unsigned char *new;
int l;
- l = strlen ((char*)s);
+ l = strlen ((const char*)s);
new = hnj_malloc (l + 1);
memcpy (new, s, l);
new[l] = 0;
@@ -173,7 +173,7 @@ static char *combine(
* --------------------------------------------------------------------
*/
-HashIter* new_HashIter(
+static HashIter* new_HashIter(
HashTab* h
) {
HashIter* i = hnj_malloc(sizeof(HashIter));
@@ -184,7 +184,7 @@ HashIter* new_HashIter(
}
-int nextHashStealPattern(
+static int nextHashStealPattern(
HashIter*i,
unsigned char**word,
char **pattern
@@ -201,7 +201,7 @@ int nextHashStealPattern(
}
-int nextHash(
+static int nextHash(
HashIter*i,
unsigned char**word
) {
@@ -215,7 +215,7 @@ int nextHash(
}
-int eachHash(
+static int eachHash(
HashIter*i,
unsigned char**word,
char**pattern
@@ -231,7 +231,7 @@ int eachHash(
}
-void delete_HashIter(
+static void delete_HashIter(
HashIter*i
) {
hnj_free(i);
@@ -318,7 +318,7 @@ static int state_lookup(
i = hnj_string_hash (key) % HASH_SIZE;
for (e = hashtab->entries[i]; e; e = e->next) {
- if (!strcmp ((char*)key, (char*)e->key)) {
+ if (!strcmp ((const char*)key, (const char*)e->key)) {
return e->u.state;
}
}
@@ -335,7 +335,7 @@ static char* hyppat_lookup(
int i;
HashEntry *e;
unsigned char key[128]; /* should be ample*/
- strncpy((char*)key,(char*)chars,l); key[l]=0;
+ strncpy((char*)key,(const char*)chars,l); key[l]=0;
i = hnj_string_hash (key) % HASH_SIZE;
for (e = hashtab->entries[i]; e; e = e->next) {
if (!strcmp ((char*)key, (char*)e->key)) {
@@ -526,7 +526,7 @@ static void clear_dict(
-HyphenDict* hnj_hyphen_new() {
+HyphenDict* hnj_hyphen_new(void) {
HyphenDict* dict = hnj_malloc (sizeof(HyphenDict));
init_dict(dict);
return dict;
@@ -695,7 +695,7 @@ void hnj_hyphen_load(
delete_HashIter(v);
init_hash(&dict->state_num);
- state_insert(dict->state_num, hnj_strdup((unsigned char*)""), 0);
+ state_insert(dict->state_num, hnj_strdup((const unsigned char*)""), 0);
v = new_HashIter(dict->merged);
while (nextHashStealPattern(v,&word,&pattern)) {
static unsigned char mask[] = {0x3F,0x1F,0xF,0x7};
diff --git a/Build/source/texk/web2c/luatexdir/lang/texlang.c b/Build/source/texk/web2c/luatexdir/lang/texlang.c
index 6550b16a8c9..c315e4e05d8 100644
--- a/Build/source/texk/web2c/luatexdir/lang/texlang.c
+++ b/Build/source/texk/web2c/luatexdir/lang/texlang.c
@@ -221,9 +221,9 @@ integer get_post_exhyphen_char(integer n)
return (integer) l->post_exhyphen_char;
}
-void load_patterns(struct tex_language *lang, unsigned char *buffer)
+void load_patterns(struct tex_language *lang, const unsigned char *buffer)
{
- if (lang == NULL || buffer == NULL || strlen((char *) buffer) == 0)
+ if (lang == NULL || buffer == NULL || strlen((const char *) buffer) == 0)
return;
if (lang->patterns == NULL) {
lang->patterns = hnj_hyphen_new();
@@ -243,7 +243,7 @@ void clear_patterns(struct tex_language *lang)
void load_tex_patterns(int curlang, halfword head)
{
char *s = tokenlist_to_cstring(head, 1, NULL);
- load_patterns(get_language(curlang), (unsigned char *) s);
+ load_patterns(get_language(curlang), (const unsigned char *) s);
}
@@ -254,12 +254,12 @@ void load_tex_patterns(int curlang, halfword head)
/* todo change this! */
-char *clean_hyphenation(char *buffer, char **cleaned)
+const char *clean_hyphenation(const char *buffer, char **cleaned)
{
int items;
unsigned char word[MAX_WORD_LEN + 1];
int w = 0;
- char *s = buffer;
+ const char *s = buffer;
while (*s && !isspace(*s)) {
if (*s == '-') { /* skip */
} else if (*s == '=') {
@@ -310,9 +310,10 @@ char *clean_hyphenation(char *buffer, char **cleaned)
return s;
}
-void load_hyphenation(struct tex_language *lang, unsigned char *buffer)
+void load_hyphenation(struct tex_language *lang, const unsigned char *buffer)
{
- char *s, *value, *cleaned;
+ const char *s, *value;
+ char *cleaned;
lua_State *L = Luas;
if (lang == NULL)
return;
@@ -321,7 +322,7 @@ void load_hyphenation(struct tex_language *lang, unsigned char *buffer)
lang->exceptions = luaL_ref(L, LUA_REGISTRYINDEX);
}
lua_rawgeti(L, LUA_REGISTRYINDEX, lang->exceptions);
- s = (char *) buffer;
+ s = (const char *) buffer;
while (*s) {
while (isspace(*s))
s++;
@@ -359,7 +360,7 @@ void clear_hyphenation(struct tex_language *lang)
void load_tex_hyphenation(int curlang, halfword head)
{
char *s = tokenlist_to_cstring(head, 1, NULL);
- load_hyphenation(get_language(curlang), (unsigned char *) s);
+ load_hyphenation(get_language(curlang), (const unsigned char *) s);
}
/* TODO: clean this up. The delete_attribute_ref() statements are not very
@@ -511,7 +512,7 @@ void set_disc_field(halfword f, halfword t)
-char *hyphenation_exception(int exceptions, char *w)
+static char *hyphenation_exception(int exceptions, char *w)
{
char *ret = NULL;
lua_State *L = Luas;
@@ -521,7 +522,7 @@ char *hyphenation_exception(int exceptions, char *w)
lua_pushstring(L, w); /* word table */
lua_rawget(L, -2);
if (lua_isstring(L, -1)) {
- ret = xstrdup((char *) lua_tostring(L, -1));
+ ret = xstrdup(lua_tostring(L, -1));
}
lua_pop(L, 2);
} else {
@@ -533,7 +534,7 @@ char *hyphenation_exception(int exceptions, char *w)
char *exception_strings(struct tex_language *lang)
{
- char *value;
+ const char *value;
size_t size = 0, current = 0;
size_t l = 0;
char *ret = NULL;
@@ -546,7 +547,7 @@ char *exception_strings(struct tex_language *lang)
/* iterate and join */
lua_pushnil(L); /* first key */
while (lua_next(L, -2) != 0) {
- value = (char *) lua_tolstring(L, -1, &l);
+ value = lua_tolstring(L, -1, &l);
if (current + 2 + l > size) {
ret = xrealloc(ret, (1.2 * size) + current + l + 1024);
size = (1.2 * size) + current + l + 1024;
@@ -564,7 +565,7 @@ char *exception_strings(struct tex_language *lang)
/* the sequence from |wordstart| to |r| can contain only normal characters */
/* it could be faster to modify a halfword pointer and return an integer */
-halfword find_exception_part(unsigned int *j, int *uword, int len)
+static halfword find_exception_part(unsigned int *j, int *uword, int len)
{
halfword g = null, gg = null;
register int i = *j;
@@ -584,7 +585,7 @@ halfword find_exception_part(unsigned int *j, int *uword, int len)
return gg;
}
-int count_exception_part(unsigned int *j, int *uword, int len)
+static int count_exception_part(unsigned int *j, int *uword, int len)
{
int ret = 0;
register int i = *j;
@@ -598,13 +599,13 @@ int count_exception_part(unsigned int *j, int *uword, int len)
}
-static char *PAT_ERROR[] = {
+static const char *PAT_ERROR[] = {
"Exception discretionaries should contain three pairs of braced items.",
"No intervening spaces are allowed.",
NULL
};
-void do_exception(halfword wordstart, halfword r, char *replacement)
+static void do_exception(halfword wordstart, halfword r, char *replacement)
{
unsigned i;
halfword t;
@@ -741,7 +742,7 @@ using an algorithm due to Frank~M. Liang.
* prohibiting hyphenation there was not the best idea ever.
*/
-halfword find_next_wordstart(halfword r)
+static halfword find_next_wordstart(halfword r)
{
register int l;
register int start_ok = 1;
@@ -781,7 +782,7 @@ halfword find_next_wordstart(halfword r)
return r;
}
-int valid_wordend(halfword s)
+static int valid_wordend(halfword s)
{
register halfword r = s;
register int clang = char_lang(s);
@@ -946,7 +947,7 @@ void new_hyphenation(halfword head, halfword tail)
}
-void dump_one_language(int i)
+static void dump_one_language(int i)
{
char *s = NULL;
integer x = 0;
@@ -989,7 +990,7 @@ void dump_language_data(void)
}
-void undump_one_language(int i)
+static void undump_one_language(int i)
{
char *s = NULL;
integer x = 0;
@@ -1009,7 +1010,7 @@ void undump_one_language(int i)
if (x > 0) {
s = xmalloc(x);
undump_things(*s, x);
- load_patterns(lang, (unsigned char *) s);
+ load_patterns(lang, (const unsigned char *) s);
free(s);
}
/* exceptions */
@@ -1017,7 +1018,7 @@ void undump_one_language(int i)
if (x > 0) {
s = xmalloc(x);
undump_things(*s, x);
- load_hyphenation(lang, (unsigned char *) s);
+ load_hyphenation(lang, (const unsigned char *) s);
free(s);
}
}