File: reassign_item.C

package info (click to toggle)
peruser 4b33-6
  • links: PTS
  • area: main
  • in suites: potato
  • size: 2,952 kB
  • ctags: 1,064
  • sloc: cpp: 22,367; perl: 2,733; makefile: 345; sh: 335
file content (25 lines) | stat: -rw-r--r-- 541 bytes parent folder | download
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
#include <stdio.h>

#include "npstringarray.h"

int NP_Stringarray::reassign_item( int i, const char *assignee )
{
   if ( i < 0 || i >= total )
   {
      snprintf( error_message, sizeof error_message,
               "NP_Stringarray: reassign_item(): index out of range: %d.", i );
      return 1;
   }
   
   if ( assignee == NULL )
   {
      strcpy( error_message, "NP_Stringarray: reassign_item(): NULL "
              "assignee item passed as argument." );
      return 1;
   }

   item_list[ i ] = ( char *)assignee;

   return 0;
}