File: create_server_list.C

package info (click to toggle)
peruser 4b33-10
  • links: PTS
  • area: main
  • in suites: woody
  • size: 2,944 kB
  • ctags: 1,064
  • sloc: cpp: 22,397; perl: 2,733; makefile: 345; sh: 335
file content (41 lines) | stat: -rw-r--r-- 820 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#include "npconfig.h"
#include "ctype.h"
#include "string.h"

void NP_Config::create_server_list( GtkWidget *outer_box )
{
   int total;
   if(( total = subscription.get_total() ) < 0 )
   {
      subscription.print_error();
      return;
   }

   if ( server_frames != NULL )
      free( server_frames );

   if (( server_frames = ( GtkWidget **)calloc( total,
                                               sizeof *server_frames ))
       == NULL )
   {
      perror( "calloc" );
      exit( 1 );
   }

   if ( total )
   {
      for( int i = 0; i < total; ++i )
      {
         const char *server;
         if (( server = subscription[ i ] ) == NULL )
         {
            subscription.print_error();
            return;
         }

         create_server_frame( outer_box, i, server );
      }
   }

   return;
}