@@ -158,7 +158,7 @@ static void _init_pair_core(int pair, int fg, int bg);
158158static void _unlink_color_pair ( const int pair_no )
159159{
160160 PDC_PAIR * p = SP -> pairs ;
161- PDC_PAIR * curr = p + pair_no ;
161+ const PDC_PAIR * curr = p + pair_no ;
162162
163163 p [curr -> next ].prev = curr -> prev ;
164164 p [curr -> prev ].next = curr -> next ;
@@ -200,7 +200,7 @@ static void _check_hash_tbl( void)
200200 if ( SP -> pair_hash_tbl_used * 5 / 4 >= SP -> pair_hash_tbl_size )
201201 {
202202 int i , n_pairs ;
203- PDC_PAIR * p = SP -> pairs ;
203+ const PDC_PAIR * p = SP -> pairs ;
204204
205205 for ( i = 1 , n_pairs = 0 ; i < SP -> pairs_allocated ; i ++ )
206206 if ( p [i ].f != UNSET_COLOR_PAIR )
@@ -287,7 +287,7 @@ few cycles by not shifting. */
287287
288288static void _set_cells_to_refresh_for_pair_change ( const int pair )
289289{
290- int x , y ;
290+ int y ;
291291 const chtype mask = ((chtype )pair << PDC_COLOR_SHIFT );
292292
293293 assert ( SP -> lines );
@@ -296,6 +296,7 @@ static void _set_cells_to_refresh_for_pair_change( const int pair)
296296 for ( y = 0 ; y < SP -> lines ; y ++ )
297297 {
298298 chtype * line = curscr -> _y [y ];
299+ int x ;
299300
300301 assert ( line );
301302 for ( x = 0 ; x < SP -> cols ; x ++ )
@@ -317,14 +318,15 @@ redrawn. */
317318
318319static void _set_cells_to_refresh_for_attr_change ( const chtype attr )
319320{
320- int x , y ;
321+ int y ;
321322
322323 assert ( SP -> lines );
323324 assert ( curscr && curscr -> _y );
324325 if ( !curscr -> _clear )
325326 for ( y = 0 ; y < SP -> lines ; y ++ )
326327 {
327328 const chtype * line = curscr -> _y [y ];
329+ int x ;
328330
329331 assert ( line );
330332 for ( x = 0 ; x < SP -> cols ; x ++ )
@@ -352,8 +354,8 @@ static void _init_pair_core(int pair, int fg, int bg)
352354
353355 while ( pair >= new_size )
354356 new_size += new_size ;
355- SP -> pairs = (PDC_PAIR * )realloc ( SP -> pairs ,
356- (new_size + 1 ) * sizeof ( PDC_PAIR ));
357+ SP -> pairs = (PDC_PAIR * )PDC_realloc_array ( SP -> pairs ,
358+ (new_size + 1 ), sizeof ( PDC_PAIR ));
357359 for ( i = SP -> pairs_allocated + 1 ; i <= new_size ; i ++ )
358360 {
359361 p = SP -> pairs + i ;
@@ -476,7 +478,7 @@ bool can_change_color(void)
476478
477479int extended_pair_content (int pair , int * fg , int * bg )
478480{
479- PDC_PAIR * p = SP -> pairs + pair ;
481+ const PDC_PAIR * p = SP -> pairs + pair ;
480482
481483 PDC_LOG (("pair_content() - called\n" ));
482484
@@ -627,7 +629,7 @@ int find_pair( int fg, int bg)
627629
628630 if ( (i = SP -> pair_hash_tbl [idx ]) > 0 )
629631 {
630- PDC_PAIR * p = SP -> pairs ;
632+ const PDC_PAIR * p = SP -> pairs ;
631633
632634 if ( p [i ].f == fg && p [i ].b == bg )
633635 {
@@ -671,7 +673,7 @@ int alloc_pair( int fg, int bg)
671673
672674int free_pair ( int pair )
673675{
674- PDC_PAIR * p ;
676+ const PDC_PAIR * p ;
675677
676678 assert ( SP && SP -> pairs );
677679 assert ( pair >= 1 && pair < SP -> pairs_allocated );
0 commit comments