/[pspp]/pspp/src/str.c
ViewVC logotype

Diff of /pspp/src/str.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.16 by jmd, Mon Sep 12 11:33:55 2005 UTC revision 1.17 by blp, Tue Oct 25 04:28:17 2005 UTC
# Line 79  nvsprintf (char *buf, const char *format Line 79  nvsprintf (char *buf, const char *format
79  void  void
80  buf_reverse (char *p, size_t nbytes)  buf_reverse (char *p, size_t nbytes)
81  {  {
82    unsigned char *h = p, *t = &h[nbytes - 1];    char *h = p, *t = &h[nbytes - 1];
83    unsigned char temp;    char temp;
84    
85    nbytes /= 2;    nbytes /= 2;
86    while (nbytes--)    while (nbytes--)
# Line 249  str_copy_trunc (char *dst, size_t dst_si Line 249  str_copy_trunc (char *dst, size_t dst_si
249      }      }
250  }  }
251    
252    /* Copies buffer SRC, of SRC_LEN bytes,
253       to DST, which is in a buffer DST_SIZE bytes long.
254       Truncates DST to DST_SIZE - 1 characters, if necessary. */
255    void
256    str_copy_buf_trunc (char *dst, size_t dst_size,
257                        const char *src, size_t src_size)
258    {
259      size_t dst_len;
260      assert (dst_size > 0);
261    
262      dst_len = src_size < dst_size ? src_size : dst_size - 1;
263      memcpy (dst, src, dst_len);
264      dst[dst_len] = '\0';
265    }
266    
267  /* Converts each character in S to uppercase. */  /* Converts each character in S to uppercase. */
268  void  void
269  str_uppercase (char *s)  str_uppercase (char *s)

Legend:
Removed from v.1.16  
changed lines
  Added in v.1.17

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26