Introduction
Introduction Statistics Contact Development Disclaimer Help
libutf: add some const's - sbase - suckless unix tools
git clone git://git.suckless.org/sbase
Log
Files
Refs
README
LICENSE
---
commit 446903d68849d9db08c9d75d04c0b86f3bf63bf0
parent 7fc2f68aeccb7e488f7a6c6efbc4b82fa7a1452a
Author: David Demelier <[email protected]>
Date: Wed, 23 Mar 2022 14:39:58 +0100
libutf: add some const's
Diffstat:
M libutf/isalpharune.c | 8 ++++----
M libutf/iscntrlrune.c | 2 +-
M libutf/isdigitrune.c | 2 +-
M libutf/isspacerune.c | 4 ++--
M libutf/istitlerune.c | 4 ++--
M libutf/lowerrune.c | 8 ++++----
M libutf/mkrunetype.awk | 14 +++++++-------
M libutf/upperrune.c | 8 ++++----
8 files changed, 25 insertions(+), 25 deletions(-)
---
diff --git a/libutf/isalpharune.c b/libutf/isalpharune.c
@@ -4,7 +4,7 @@
#include "../utf.h"
#include "runetype.h"
-static Rune alpha3[][2] = {
+static const Rune alpha3[][2] = {
{ 0x00D6, 0x00D8 },
{ 0x00F6, 0x00F8 },
{ 0x02EC, 0x02EE },
@@ -201,7 +201,7 @@ static Rune alpha3[][2] = {
{ 0x1EEA9, 0x1EEAB },
};
-static Rune alpha2[][2] = {
+static const Rune alpha2[][2] = {
{ 0x0041, 0x005A },
{ 0x0061, 0x007A },
{ 0x00C0, 0x00D6 },
@@ -715,7 +715,7 @@ static Rune alpha2[][2] = {
{ 0x2F800, 0x2FA1D },
};
-static Rune alpha1[] = {
+static const Rune alpha1[] = {
0x00AA,
0x00B5,
0x00BA,
@@ -818,7 +818,7 @@ static Rune alpha1[] = {
int
isalpharune(Rune r)
{
- Rune *match;
+ const Rune *match;
if((match = bsearch(&r, alpha3, nelem(alpha3), sizeof *alpha3, &rune2c…
return !((r - match[0]) % 2);
diff --git a/libutf/iscntrlrune.c b/libutf/iscntrlrune.c
@@ -4,7 +4,7 @@
#include "../utf.h"
#include "runetype.h"
-static Rune cntrl2[][2] = {
+static const Rune cntrl2[][2] = {
{ 0x0000, 0x001F },
{ 0x007F, 0x009F },
};
diff --git a/libutf/isdigitrune.c b/libutf/isdigitrune.c
@@ -4,7 +4,7 @@
#include "../utf.h"
#include "runetype.h"
-static Rune digit2[][2] = {
+static const Rune digit2[][2] = {
{ 0x0030, 0x0039 },
{ 0x0660, 0x0669 },
{ 0x06F0, 0x06F9 },
diff --git a/libutf/isspacerune.c b/libutf/isspacerune.c
@@ -4,14 +4,14 @@
#include "../utf.h"
#include "runetype.h"
-static Rune space2[][2] = {
+static const Rune space2[][2] = {
{ 0x0009, 0x000D },
{ 0x001C, 0x0020 },
{ 0x2000, 0x200A },
{ 0x2028, 0x2029 },
};
-static Rune space1[] = {
+static const Rune space1[] = {
0x0085,
0x00A0,
0x1680,
diff --git a/libutf/istitlerune.c b/libutf/istitlerune.c
@@ -4,13 +4,13 @@
#include "../utf.h"
#include "runetype.h"
-static Rune title2[][2] = {
+static const Rune title2[][2] = {
{ 0x1F88, 0x1F8F },
{ 0x1F98, 0x1F9F },
{ 0x1FA8, 0x1FAF },
};
-static Rune title1[] = {
+static const Rune title1[] = {
0x01C5,
0x01C8,
0x01CB,
diff --git a/libutf/lowerrune.c b/libutf/lowerrune.c
@@ -4,7 +4,7 @@
#include "../utf.h"
#include "runetype.h"
-static Rune lower4[][2] = {
+static const Rune lower4[][2] = {
{ 0x0101, 0x012F },
{ 0x0133, 0x0137 },
{ 0x013A, 0x0148 },
@@ -42,7 +42,7 @@ static Rune lower4[][2] = {
{ 0xA7D7, 0xA7D9 },
};
-static Rune lower2[][3] = {
+static const Rune lower2[][3] = {
{ 0x0061, 0x007A, 0x0041 },
{ 0x00E0, 0x00F6, 0x00C0 },
{ 0x00F8, 0x00FE, 0x00D8 },
@@ -161,7 +161,7 @@ static Rune lower2[][3] = {
{ 0x1E922, 0x1E943, 0x1E900 },
};
-static Rune lower1[][2] = {
+static const Rune lower1[][2] = {
{ 0x00B5, 0x039C },
{ 0x00DF, 0x00DF },
{ 0x00FF, 0x0178 },
@@ -327,7 +327,7 @@ static Rune lower1[][2] = {
int
islowerrune(Rune r)
{
- Rune *match;
+ const Rune *match;
if((match = bsearch(&r, lower4, nelem(lower4), sizeof *lower4, &rune2c…
return !((r - match[0]) % 2);
diff --git a/libutf/mkrunetype.awk b/libutf/mkrunetype.awk
@@ -129,7 +129,7 @@ function mkis(name, runev, runec, file, casev, casename) {
#generate list of laces 1
if(rune3c > 0) {
- print "static Rune "name"3[][2] = {" > file;
+ print "static const Rune "name"3[][2] = {" > file;
for(j = 0; j < rune3c; j++) {
print "\t{ 0x"rune3v0[j]", 0x"rune3v1[j]" }," > file;
}
@@ -138,7 +138,7 @@ function mkis(name, runev, runec, file, casev, casename) {
#generate list of laces 2
if(rune4c > 0) {
- print "static Rune "name"4[][2] = {" > file;
+ print "static const Rune "name"4[][2] = {" > file;
for(j = 0; j < rune4c; j++) {
print "\t{ 0x"rune4v0[j]", 0x"rune4v1[j]" }," > file;
}
@@ -148,12 +148,12 @@ function mkis(name, runev, runec, file, casev, casename) {
# generate list of ranges
if(rune2c > 0) {
if(length(casev) > 0) {
- print "static Rune "name"2[][3] = {" > file;
+ print "static const Rune "name"2[][3] = {" > file;
for(j = 0; j < rune2c; j++) {
print "\t{ 0x"rune2v0[j]", 0x"rune2v1[j]", 0x"…
}
} else {
- print "static Rune "name"2[][2] = {" > file
+ print "static const Rune "name"2[][2] = {" > file
for(j = 0; j < rune2c; j++) {
print "\t{ 0x"rune2v0[j]", 0x"rune2v1[j]" }," …
}
@@ -164,12 +164,12 @@ function mkis(name, runev, runec, file, casev, casename) {
# generate list of singletons
if(rune1c > 0) {
if(length(casev) > 0) {
- print "static Rune "name"1[][2] = {" > file;
+ print "static const Rune "name"1[][2] = {" > file;
for(j = 0; j < rune1c; j++) {
print "\t{ 0x"rune1v[j]", 0x"case1v[j]" }," > …
}
} else {
- print "static Rune "name"1[] = {" > file;
+ print "static const Rune "name"1[] = {" > file;
for(j = 0; j < rune1c; j++) {
print "\t0x"rune1v[j]"," > file;
}
@@ -179,7 +179,7 @@ function mkis(name, runev, runec, file, casev, casename) {
# generate lookup function
print "int\nis"name"rune(Rune r)\n{" > file;
if(rune4c > 0 || rune3c > 0)
- print "\tRune *match;\n" > file;
+ print "\tconst Rune *match;\n" > file;
if(rune4c > 0) {
print "\tif((match = bsearch(&r, "name"4, nelem("name"4), size…
print "\t\treturn !((r - match[0]) % 2);" > file;
diff --git a/libutf/upperrune.c b/libutf/upperrune.c
@@ -4,7 +4,7 @@
#include "../utf.h"
#include "runetype.h"
-static Rune upper3[][2] = {
+static const Rune upper3[][2] = {
{ 0x0100, 0x012E },
{ 0x0132, 0x0136 },
{ 0x0139, 0x0147 },
@@ -42,7 +42,7 @@ static Rune upper3[][2] = {
{ 0xA7D6, 0xA7D8 },
};
-static Rune upper2[][3] = {
+static const Rune upper2[][3] = {
{ 0x0041, 0x005A, 0x0061 },
{ 0x00C0, 0x00D6, 0x00E0 },
{ 0x00D8, 0x00DE, 0x00F8 },
@@ -125,7 +125,7 @@ static Rune upper2[][3] = {
{ 0x1E900, 0x1E921, 0x1E922 },
};
-static Rune upper1[][2] = {
+static const Rune upper1[][2] = {
{ 0x0130, 0x0069 },
{ 0x0178, 0x00FF },
{ 0x0181, 0x0253 },
@@ -236,7 +236,7 @@ static Rune upper1[][2] = {
int
isupperrune(Rune r)
{
- Rune *match;
+ const Rune *match;
if((match = bsearch(&r, upper3, nelem(upper3), sizeof *upper3, &rune2c…
return !((r - match[0]) % 2);
You are viewing proxied material from suckless.org. 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.