Mirror of :pserver:cvs@cvs.fefe.de:/cvs libowfat https://www.fefe.de/libowfat/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

15 lines
429 B

  1. #include "byte.h"
  2. #include "stralloc.h"
  3. /* stralloc_copyb copies the string buf[0], buf[1], ..., buf[len-1] into
  4. * sa, allocating space if necessary, and returns 1. If it runs out of
  5. * memory, stralloc_copyb leaves sa alone and returns 0. */
  6. int stralloc_copyb(stralloc *sa,const char *buf,unsigned long int len) {
  7. if (stralloc_ready(sa,len)) {
  8. sa->len=len;
  9. byte_copy(sa->s,len,buf);
  10. return 1;
  11. }
  12. return 0;
  13. }