mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-24 20:30:28 +02:00
* gh_data.c, ports.c, strop.c: Alternatively use bcopy if memmove
isn't present. (Thanks to suzukis@file.phys.tohoku.ac.jp.)
This commit is contained in:
parent
f326ecf386
commit
5e860ea7e2
2 changed files with 18 additions and 0 deletions
|
@ -115,7 +115,15 @@ gh_set_substr (char *src, SCM dst, int start, int len)
|
||||||
|
|
||||||
scm_protect_object (dst);
|
scm_protect_object (dst);
|
||||||
effective_length = ((unsigned) len < dst_len) ? len : dst_len;
|
effective_length = ((unsigned) len < dst_len) ? len : dst_len;
|
||||||
|
#ifdef HAVE_MEMMOVE
|
||||||
memmove (dst_ptr + start, src, effective_length);
|
memmove (dst_ptr + start, src, effective_length);
|
||||||
|
#else
|
||||||
|
#ifdef HAVE_BCOPY
|
||||||
|
bcopy (src, dst_ptr + start, effective_length);
|
||||||
|
#else
|
||||||
|
#error Need memmove. Please send a bug report to bug-guile@gnu.org.
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
scm_unprotect_object (dst);
|
scm_unprotect_object (dst);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -147,9 +147,19 @@ scm_substring_move_x (SCM str1, SCM start1, SCM end1,
|
||||||
SCM_ASSERT (len+s2 <= SCM_LENGTH (str2), start2,
|
SCM_ASSERT (len+s2 <= SCM_LENGTH (str2), start2,
|
||||||
SCM_OUTOFRANGE, s_substring_move_x);
|
SCM_OUTOFRANGE, s_substring_move_x);
|
||||||
|
|
||||||
|
#ifdef HAVE_MEMMOVE
|
||||||
SCM_SYSCALL(memmove((void *)(&(SCM_CHARS(str2)[s2])),
|
SCM_SYSCALL(memmove((void *)(&(SCM_CHARS(str2)[s2])),
|
||||||
(void *)(&(SCM_CHARS(str1)[s1])),
|
(void *)(&(SCM_CHARS(str1)[s1])),
|
||||||
len));
|
len));
|
||||||
|
#else
|
||||||
|
#ifdef HAVE_BCOPY
|
||||||
|
SCM_SYSCALL(bcopy((void *)(&(SCM_CHARS(str1)[s1])),
|
||||||
|
(void *)(&(SCM_CHARS(str2)[s2])),
|
||||||
|
len));
|
||||||
|
#else
|
||||||
|
#error Need memmove. Please send a bug report to bug-guile@gnu.org.
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
return scm_return_first(SCM_UNSPECIFIED, str1, str2);
|
return scm_return_first(SCM_UNSPECIFIED, str1, str2);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue