home *** CD-ROM | disk | FTP | other *** search
/ Geek Gadgets 1 / ADE-1.bin / ade-bin / x11r6.1 / man / cat3 / xtmalloc.0 < prev    next >
Encoding:
Text File  |  1996-10-17  |  3.5 KB  |  133 lines

  1.  
  2.  
  3.  
  4. XtMalloc(3Xt)           XT FUNCTIONS            XtMalloc(3Xt)
  5.  
  6.  
  7. NNAAMMEE
  8.        XtMalloc, XtCalloc, XtRealloc, XtFree, XtNew, XtNewString
  9.        - memory management functions
  10.  
  11. SSYYNNTTAAXX
  12.        char *XtMalloc(_s_i_z_e);
  13.          Cardinal _s_i_z_e;
  14.  
  15.        char *XtCalloc(_n_u_m, _s_i_z_e);
  16.          Cardinal _n_u_m;
  17.          Cardinal _s_i_z_e;
  18.  
  19.        char *XtRealloc(_p_t_r, _n_u_m);
  20.          char *_p_t_r;
  21.          Cardinal _n_u_m;
  22.  
  23.        void XtFree(_p_t_r);
  24.          char *_p_t_r;
  25.  
  26.        _t_y_p_e *XtNew(_t_y_p_e);
  27.          _t_y_p_e;
  28.  
  29.        String XtNewString(_s_t_r_i_n_g);
  30.          String _s_t_r_i_n_g;
  31.  
  32. AARRGGUUMMEENNTTSS
  33.        _n_u_m     Specifies the number of bytes or array elements.
  34.  
  35.        _p_t_r     Specifies a pointer to the old storage or to the
  36.          block of storage that is to be freed.
  37.  
  38.        _s_i_z_e     Specifies the size of an array element (in
  39.          bytes) or the number of bytes desired.
  40.  
  41.        _s_t_r_i_n_g     Specifies a previously declared string.
  42.  
  43.        _t_y_p_e     Specifies a previously declared data type.
  44.  
  45. DDEESSCCRRIIPPTTIIOONN
  46.        The _X_t_M_a_l_l_o_c functions returns a pointer to a block of
  47.        storage of at least the specified size bytes.  If there is
  48.        insufficient memory to allocate the new block, _X_t_M_a_l_l_o_c
  49.        calls _X_t_E_r_r_o_r_M_s_g.
  50.  
  51.        The _X_t_C_a_l_l_o_c function allocates space for the specified
  52.        number of array elements of the specified size and ini-
  53.        tializes the space to zero.  If there is insufficient mem-
  54.        ory to allocate the new block, _X_t_C_a_l_l_o_c calls _X_t_E_r_r_o_r_M_s_g.
  55.  
  56.        The _X_t_R_e_a_l_l_o_c function changes the size of a block of
  57.        storage (possibly moving it).  Then, it copies the old
  58.        contents (or as much as will fit) into the new block and
  59.        frees the old block.  If there is insufficient memory to
  60.        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
  61.  
  62.  
  63.  
  64. X Version 11           Release 6.1                1
  65.  
  66.  
  67.  
  68.  
  69.  
  70. XtMalloc(3Xt)           XT FUNCTIONS            XtMalloc(3Xt)
  71.  
  72.  
  73.        ptr is NULL, _X_t_R_e_a_l_l_o_c allocates the new storage without
  74.        copying the old contents; that is, it simply calls
  75.        _X_t_M_a_l_l_o_c.
  76.  
  77.        The _X_t_F_r_e_e function returns storage and allows it to be
  78.        reused.    If ptr is NULL, _X_t_F_r_e_e returns immediately.
  79.  
  80.        _X_t_N_e_w returns a pointer to the allocated storage.  If
  81.        there is insufficient memory to allocate the new block,
  82.        _X_t_N_e_w calls _X_t_E_r_r_o_r_M_s_g.    _X_t_N_e_w is a convenience macro that
  83.        calls _X_t_M_a_l_l_o_c with the following arguments specified:
  84.  
  85.        ((type *) XtMalloc((unsigned) sizeof(type))
  86.  
  87.        _X_t_N_e_w_S_t_r_i_n_g returns a pointer to the allocated storage.
  88.        If there is insufficient memory to allocate the new block,
  89.        _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 conve-
  90.        nience macro that calls _X_t_M_a_l_l_o_c with the following argu-
  91.        ments specified:
  92.  
  93.        (strcpy(XtMalloc((unsigned) strlen(str) + 1), str))
  94.  
  95. SSEEEE AALLSSOO
  96.        _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
  97.        _X_l_i_b _- _C _L_a_n_g_u_a_g_e _X _I_n_t_e_r_f_a_c_e
  98.  
  99.  
  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.  
  130. X Version 11           Release 6.1                2
  131.  
  132.  
  133.