/* $RCSfile: str.c,v $$Revision: 4.1 $$Date: 92/08/07 18:29:26 $
*
- * Copyright (c) 1991-2001, Larry Wall
+ * Copyright (C) 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1999,
+ * 2001, 2002, by Larry Wall and others
*
* You may distribute under the terms of either the GNU General Public
* License or the Artistic License, as specified in the README file.
str_nset(register STR *str, register char *ptr, register int len)
{
GROWSTR(&(str->str_ptr), &(str->str_len), len + 1);
- bcopy(ptr,str->str_ptr,len);
+ memcpy(str->str_ptr,ptr,len);
str->str_cur = len;
*(str->str_ptr+str->str_cur) = '\0';
str->str_nok = 0; /* invalidate number */
ptr = "";
len = strlen(ptr);
GROWSTR(&(str->str_ptr), &(str->str_len), len + 1);
- bcopy(ptr,str->str_ptr,len+1);
+ memcpy(str->str_ptr,ptr,len+1);
str->str_cur = len;
str->str_nok = 0; /* invalidate number */
str->str_pok = 1; /* validate pointer */
if (!(str->str_pok))
str_2ptr(str);
str->str_cur -= (ptr - str->str_ptr);
- bcopy(ptr,str->str_ptr, str->str_cur + 1);
+ memcpy(str->str_ptr, ptr, str->str_cur + 1);
str->str_nok = 0; /* invalidate number */
str->str_pok = 1; /* validate pointer */
}
if (!(str->str_pok))
str_2ptr(str);
GROWSTR(&(str->str_ptr), &(str->str_len), str->str_cur + len + 1);
- bcopy(ptr,str->str_ptr+str->str_cur,len);
+ memcpy(str->str_ptr+str->str_cur, ptr, len);
str->str_cur += len;
*(str->str_ptr+str->str_cur) = '\0';
str->str_nok = 0; /* invalidate number */
str_2ptr(str);
len = strlen(ptr);
GROWSTR(&(str->str_ptr), &(str->str_len), str->str_cur + len + 1);
- bcopy(ptr,str->str_ptr+str->str_cur,len+1);
+ memcpy(str->str_ptr+str->str_cur, ptr, len+1);
str->str_cur += len;
str->str_nok = 0; /* invalidate number */
str->str_pok = 1; /* validate pointer */
}
else {
str = (STR *) safemalloc(sizeof(STR));
- bzero((char*)str,sizeof(STR));
+ memset((char*)str,0,sizeof(STR));
}
if (len)
GROWSTR(&(str->str_ptr), &(str->str_len), len + 1);
if (str->str_len <= cnt) /* make sure we have the room */
GROWSTR(&(str->str_ptr), &(str->str_len), cnt+1);
bp = str->str_ptr; /* move these two too to registers */
- ptr = FILE_ptr(fp);
+ ptr = (STDCHAR*)FILE_ptr(fp);
for (;;) {
while (--cnt >= 0) {
if ((*bp++ = *ptr++) == newline) {
}
FILE_cnt(fp) = cnt; /* deregisterize cnt and ptr */
- FILE_ptr(fp) = ptr;
+ FILE_ptr(fp) = (void*)ptr; /* LHS STDCHAR* cast non-portable */
i = getc(fp); /* get more characters */
cnt = FILE_cnt(fp);
- ptr = FILE_ptr(fp); /* reregisterize cnt and ptr */
+ ptr = (STDCHAR*)FILE_ptr(fp); /* reregisterize cnt and ptr */
bpx = bp - str->str_ptr; /* prepare for possible relocation */
GROWSTR(&(str->str_ptr), &(str->str_len), str->str_cur + cnt + 1);
thats_all_folks:
FILE_cnt(fp) = cnt; /* put these back or we're in trouble */
- FILE_ptr(fp) = ptr;
+ FILE_ptr(fp) = (void*)ptr; /* LHS STDCHAR* cast non-portable */
*bp = '\0';
str->str_cur = bp - str->str_ptr; /* set length */