Skip to content
Draft
2 changes: 2 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,8 @@ AX_GCC_FUNC_ATTRIBUTE([fallthrough])
AX_GCC_FUNC_ATTRIBUTE([malloc])
AX_GCC_FUNC_ATTRIBUTE([malloc_args])
AX_GCC_FUNC_ATTRIBUTE([alloc_size])
AX_GCC_FUNC_ATTRIBUTE([nonnull])
AX_GCC_FUNC_ATTRIBUTE([returns_nonnull])

AC_CONFIG_FILES([Makefile joe/Makefile joe/util/Makefile rc/Makefile
man/Makefile man/ru/Makefile syntax/Makefile po/Makefile colors/Makefile
Expand Down
17 changes: 6 additions & 11 deletions joe/blocks.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,15 @@

#if SIZEOF_INT == 8
# define SHFT 3
# define INTFILL_CHAR 0x0101010101010101
#elif SIZEOF_INT == 4
# define SHFT 2
# define INTFILL_CHAR 0x01010101
#elif SIZEOF_INT == 2
# define SHFT 1
# define INTFILL_CHAR 0x0101
#else
# error I do not know how to handle your strange integers
#endif

/* Set 'sz' 'int's beginning at 'd' to the value 'c' */
Expand Down Expand Up @@ -206,17 +211,7 @@ char *mset(char *dest, char c, ptrdiff_t sz)
d += z;
sz -= z;
}
msetI((int *)d,
#if SIZEOF_INT >= 8
(c << (BITS * 7)) + (c << (BITS * 6)) + (c << (BITS * 5)) + (c << (BITS * 4)) +
#endif
#if SIZEOF_INT >= 4
(c << (BITS * 3)) + (c << (BITS * 2)) +
#endif
#if SIZEOF_INT >= 2
(c << BITS) +
#endif
c, sz >> SHFT);
msetI((int *)d, ((int)c & 255) * INTFILL_CHAR, sz >> SHFT);
d += sz & ~(SIZEOF_INT - 1);
switch (sz & (SIZEOF_INT - 1)) {
case 7: d[6] = c; FALLTHROUGH
Expand Down
10 changes: 5 additions & 5 deletions joe/charmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,8 @@ int from_utf8(struct charmap *map,const char *s)
/* Aliases */

static const struct {
const char *alias;
const char *builtin;
const char alias[12];
const char builtin[12];
} alias_table[] = {
{ "c", "ascii" },
{ "posix", "ascii" },
Expand Down Expand Up @@ -129,7 +129,7 @@ static const struct {
{ "latin8", "iso-8859-14" },
{ "latin9", "iso-8859-15" },
{ "latin10", "iso-8859-16" },
{ 0, 0 }
{}
};

/* I took all the ISO-8859- ones, plus any ones referenced by a locale */
Expand Down Expand Up @@ -1368,7 +1368,7 @@ struct charmap *find_charmap(const char *name)
load_builtins();

/* Alias? */
for (y=0; alias_table[y].alias; ++y)
for (y=0; alias_table[y].alias[0]; ++y)
if (!map_name_cmp(alias_table[y].alias,name)) {
name = alias_table[y].builtin;
break;
Expand Down Expand Up @@ -1435,7 +1435,7 @@ char **get_encodings(void)

/* Aliases */

for (y=0; alias_table[y].alias; ++y) {
for (y=0; alias_table[y].alias[0]; ++y) {
r = vsncpy(NULL,0,sz(alias_table[y].alias));
encodings = vaadd(encodings, r);
}
Expand Down
Loading
Loading