home *** CD-ROM | disk | FTP | other *** search
/ IRIX Base Documentation 2001 May / SGI IRIX Base Documentation 2001 May.iso / usr / share / catman / p_man / cat3 / Xt / XtMalloc.z / XtMalloc
Encoding:
Text File  |  1998-10-30  |  4.6 KB  |  133 lines

  1.  
  2.  
  3.  
  4.      XXXXttttMMMMaaaalllllllloooocccc((((3333XXXXtttt))))      XXXX VVVVeeeerrrrssssiiiioooonnnn 11111111 ((((RRRReeeelllleeeeaaaasssseeee 6666....3333))))       XXXXttttMMMMaaaalllllllloooocccc((((3333XXXXtttt))))
  5.  
  6.  
  7.  
  8.      NNNNAAAAMMMMEEEE
  9.           XtMalloc, XtCalloc, XtRealloc, XtFree, XtNew, XtNewString -
  10.           memory management functions
  11.  
  12.      SSSSYYYYNNNNTTTTAAAAXXXX
  13.           char *XtMalloc(_s_i_z_e);
  14.                 Cardinal _s_i_z_e;
  15.  
  16.           char *XtCalloc(_n_u_m, _s_i_z_e);
  17.                 Cardinal _n_u_m;
  18.                 Cardinal _s_i_z_e;
  19.  
  20.           char *XtRealloc(_p_t_r, _n_u_m);
  21.                 char *_p_t_r;
  22.                 Cardinal _n_u_m;
  23.  
  24.           void XtFree(_p_t_r);
  25.                 char *_p_t_r;
  26.  
  27.           _t_y_p_e *XtNew(_t_y_p_e);
  28.                 _t_y_p_e;
  29.  
  30.           String XtNewString(_s_t_r_i_n_g);
  31.                 String _s_t_r_i_n_g;
  32.  
  33.      AAAARRRRGGGGUUUUMMMMEEEENNNNTTTTSSSS
  34.           _n_u_m       Specifies the number of bytes or array elements.
  35.  
  36.           _p_t_r       Specifies a pointer to the old storage or to the
  37.                     block of storage that is to be freed.
  38.  
  39.           _s_i_z_e      Specifies the size of an array element (in bytes)
  40.                     or the number of bytes desired.
  41.  
  42.           _s_t_r_i_n_g    Specifies a previously declared string.
  43.  
  44.           _t_y_p_e      Specifies a previously declared data type.
  45.  
  46.      DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
  47.           The _X_t_M_a_l_l_o_c functions returns a pointer to a block of
  48.           storage of at least the specified size bytes.  If there is
  49.           insufficient memory to allocate the new block, _X_t_M_a_l_l_o_c
  50.           calls _X_t_E_r_r_o_r_M_s_g.
  51.  
  52.           The _X_t_C_a_l_l_o_c function allocates space for the specified
  53.           number of array elements of the specified size and
  54.           initializes the space to zero.  If there is insufficient
  55.           memory to allocate the new block, _X_t_C_a_l_l_o_c calls _X_t_E_r_r_o_r_M_s_g.
  56.  
  57.           The _X_t_R_e_a_l_l_o_c function changes the size of a block of
  58.           storage (possibly moving it).  Then, it copies the old
  59.           contents (or as much as will fit) into the new block and
  60.  
  61.  
  62.  
  63.      Page 1                                          (printed 4/30/98)
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.      XXXXttttMMMMaaaalllllllloooocccc((((3333XXXXtttt))))      XXXX VVVVeeeerrrrssssiiiioooonnnn 11111111 ((((RRRReeeelllleeeeaaaasssseeee 6666....3333))))       XXXXttttMMMMaaaalllllllloooocccc((((3333XXXXtttt))))
  71.  
  72.  
  73.  
  74.           frees the old block.  If there is insufficient memory to
  75.           allocate the new block, _X_t_R_e_a_l_l_o_c calls _X_t_E_r_r_o_r_M_s_g.  If ptr
  76.           is NULL, _X_t_R_e_a_l_l_o_c allocates the new storage without copying
  77.           the old contents; that is, it simply calls _X_t_M_a_l_l_o_c.
  78.  
  79.           The _X_t_F_r_e_e function returns storage and allows it to be
  80.           reused.  If ptr is NULL, _X_t_F_r_e_e returns immediately.
  81.  
  82.           _X_t_N_e_w returns a pointer to the allocated storage.  If there
  83.           is insufficient memory to allocate the new block, _X_t_N_e_w
  84.           calls _X_t_E_r_r_o_r_M_s_g.  _X_t_N_e_w is a convenience macro that calls
  85.           _X_t_M_a_l_l_o_c with the following arguments specified:
  86.  
  87.           ((type *) XtMalloc((unsigned) sizeof(type))
  88.  
  89.           _X_t_N_e_w_S_t_r_i_n_g returns a pointer to the allocated storage.  If
  90.           there is insufficient memory to allocate the new block,
  91.           _X_t_N_e_w_S_t_r_i_n_g calls _X_t_E_r_r_o_r_M_s_g.  _X_t_N_e_w_S_t_r_i_n_g is a convenience
  92.           macro that calls _X_t_M_a_l_l_o_c with the following arguments
  93.           specified:
  94.  
  95.           (strcpy(XtMalloc((unsigned) strlen(str) + 1), str))
  96.  
  97.      SSSSEEEEEEEE AAAALLLLSSSSOOOO
  98.           _X _T_o_o_l_k_i_t _I_n_t_r_i_n_s_i_c_s - _C _L_a_n_g_u_a_g_e _I_n_t_e_r_f_a_c_e
  99.           _X_l_i_b - _C _L_a_n_g_u_a_g_e _X _I_n_t_e_r_f_a_c_e
  100.  
  101.  
  102.  
  103.  
  104.  
  105.  
  106.  
  107.  
  108.  
  109.  
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.      Page 2                                          (printed 4/30/98)
  130.  
  131.  
  132.  
  133.