@@ -198,18 +198,18 @@ static void tputc(Rune);
198198static void treset (void );
199199static void tscrollup (int , int );
200200static void tscrolldown (int , int );
201- static void tsetattr (int * , int );
202- static void tsetchar (Rune , Glyph * , int , int );
201+ static void tsetattr (const int * , int );
202+ static void tsetchar (Rune , const Glyph * , int , int );
203203static void tsetdirt (int , int );
204204static void tsetscroll (int , int );
205205static void tswapscreen (void );
206- static void tsetmode (int , int , int * , int );
206+ static void tsetmode (int , int , const int * , int );
207207static int twrite (const char * , int , int );
208208static void tfulldirt (void );
209209static void tcontrolcode (uchar );
210210static void tdectest (char );
211211static void tdefutf8 (char );
212- static int32_t tdefcolor (int * , int * , int );
212+ static int32_t tdefcolor (const int * , int * , int );
213213static void tdeftran (char );
214214static void tstrsequence (uchar );
215215static void tsetcolor (int , int , int , uint32_t , uint32_t );
@@ -241,10 +241,10 @@ static int iofd = 1;
241241static int cmdfd ;
242242static pid_t pid ;
243243
244- static uchar utfbyte [UTF_SIZ + 1 ] = { 0x80 , 0 , 0xC0 , 0xE0 , 0xF0 };
245- static uchar utfmask [UTF_SIZ + 1 ] = { 0xC0 , 0x80 , 0xE0 , 0xF0 , 0xF8 };
246- static Rune utfmin [UTF_SIZ + 1 ] = { 0 , 0 , 0x80 , 0x800 , 0x10000 };
247- static Rune utfmax [UTF_SIZ + 1 ] = {0x10FFFF , 0x7F , 0x7FF , 0xFFFF , 0x10FFFF };
244+ static const uchar utfbyte [UTF_SIZ + 1 ] = { 0x80 , 0 , 0xC0 , 0xE0 , 0xF0 };
245+ static const uchar utfmask [UTF_SIZ + 1 ] = { 0xC0 , 0x80 , 0xE0 , 0xF0 , 0xF8 };
246+ static const Rune utfmin [UTF_SIZ + 1 ] = { 0 , 0 , 0x80 , 0x800 , 0x10000 };
247+ static const Rune utfmax [UTF_SIZ + 1 ] = {0x10FFFF , 0x7F , 0x7FF , 0xFFFF , 0x10FFFF };
248248
249249int buffCols ;
250250
@@ -301,12 +301,14 @@ xrealloc(void *p, size_t len)
301301}
302302
303303char *
304- xstrdup (char * s )
304+ xstrdup (const char * s )
305305{
306- if ((s = strdup (s )) == NULL )
306+ char * p ;
307+
308+ if ((p = strdup (s )) == NULL )
307309 die ("strdup: %s\n" , strerror (errno ));
308310
309- return s ;
311+ return p ;
310312}
311313
312314size_t
@@ -823,7 +825,7 @@ stty(char **args)
823825}
824826
825827int
826- ttynew (char * line , char * cmd , char * out , char * * args )
828+ ttynew (const char * line , char * cmd , const char * out , char * * args )
827829{
828830 int m , s ;
829831
@@ -1273,9 +1275,9 @@ tmoveto(int x, int y)
12731275}
12741276
12751277void
1276- tsetchar (Rune u , Glyph * attr , int x , int y )
1278+ tsetchar (Rune u , const Glyph * attr , int x , int y )
12771279{
1278- static char * vt100_0 [62 ] = { /* 0x41 - 0x7e */
1280+ static const char * vt100_0 [62 ] = { /* 0x41 - 0x7e */
12791281 "↑" , "↓" , "→" , "←" , "█" , "▚" , "☃" , /* A - G */
12801282 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , /* H - O */
12811283 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , /* P - W */
@@ -1387,7 +1389,7 @@ tdeleteline(int n)
13871389}
13881390
13891391int32_t
1390- tdefcolor (int * attr , int * npar , int l )
1392+ tdefcolor (const int * attr , int * npar , int l )
13911393{
13921394 int32_t idx = -1 ;
13931395 uint r , g , b ;
@@ -1439,7 +1441,7 @@ tdefcolor(int *attr, int *npar, int l)
14391441}
14401442
14411443void
1442- tsetattr (int * attr , int l )
1444+ tsetattr (const int * attr , int l )
14431445{
14441446 int i ;
14451447 int32_t idx ;
@@ -1557,9 +1559,10 @@ tsetscroll(int t, int b)
15571559}
15581560
15591561void
1560- tsetmode (int priv , int set , int * args , int narg )
1562+ tsetmode (int priv , int set , const int * args , int narg )
15611563{
1562- int alt , * lim ;
1564+ int alt ;
1565+ const int * lim ;
15631566
15641567 for (lim = args + narg ; args < lim ; ++ args ) {
15651568 if (priv ) {
@@ -2109,7 +2112,7 @@ void
21092112tdumpline (int n )
21102113{
21112114 char buf [UTF_SIZ ];
2112- Glyph * bp , * end ;
2115+ const Glyph * bp , * end ;
21132116
21142117 bp = & term .line [n ][0 ];
21152118 end = & bp [MIN (tlinelen (n ), term .col ) - 1 ];
0 commit comments