mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-17 01:00:20 +02:00
Merge commit 'fdd319e9bd
'
This commit is contained in:
commit
086bbcc874
7 changed files with 41 additions and 24 deletions
|
@ -623,7 +623,7 @@ SCM_DEFINE (scm_bytevector_copy, "bytevector-copy", 1, 0, 0,
|
|||
c_len = SCM_BYTEVECTOR_LENGTH (bv);
|
||||
c_bv = SCM_BYTEVECTOR_CONTENTS (bv);
|
||||
|
||||
copy = make_bytevector (c_len, SCM_BYTEVECTOR_ELEMENT_TYPE (bv));
|
||||
copy = make_bytevector (c_len, SCM_ARRAY_ELEMENT_TYPE_VU8);
|
||||
c_copy = SCM_BYTEVECTOR_CONTENTS (copy);
|
||||
memcpy (c_copy, c_bv, c_len);
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* Copyright (C) 1995, 1996, 1997, 1998, 2000, 2001, 2004, 2006, 2010,
|
||||
* 2012, 2013, 2014 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1995-1998, 2000, 2001, 2004, 2006, 2010, 2012-2014
|
||||
* Free Software Foundation, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public License
|
||||
|
@ -121,10 +121,13 @@ SCM_DEFINE (scm_strerror, "strerror", 1, 0, 0,
|
|||
#define FUNC_NAME s_scm_strerror
|
||||
{
|
||||
SCM ret;
|
||||
int errnum = scm_to_int (err); /* Must be done outside of the
|
||||
critical section below, to avoid a
|
||||
deadlock on errors. */
|
||||
scm_dynwind_begin (0);
|
||||
scm_i_dynwind_pthread_mutex_lock (&scm_i_misc_mutex);
|
||||
|
||||
ret = scm_from_locale_string (strerror (scm_to_int (err)));
|
||||
ret = scm_from_locale_string (strerror (errnum));
|
||||
|
||||
scm_dynwind_end ();
|
||||
return ret;
|
||||
|
|
|
@ -469,23 +469,22 @@ stringbuf_cat (struct stringbuf *buf, char *str)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/* Return non-zero if STR is suffixed by a dot followed by one of
|
||||
EXTENSIONS. */
|
||||
static int
|
||||
scm_c_string_has_an_ext (char *str, size_t len, SCM extensions)
|
||||
string_has_an_ext (SCM str, SCM extensions)
|
||||
{
|
||||
for (; !scm_is_null (extensions); extensions = SCM_CDR (extensions))
|
||||
{
|
||||
char *ext;
|
||||
size_t extlen;
|
||||
int match;
|
||||
ext = scm_to_locale_string (SCM_CAR (extensions));
|
||||
extlen = strlen (ext);
|
||||
match = (len > extlen && str[len - extlen - 1] == '.'
|
||||
&& strncmp (str + (len - extlen), ext, extlen) == 0);
|
||||
free (ext);
|
||||
if (match)
|
||||
return 1;
|
||||
SCM extension;
|
||||
|
||||
extension = SCM_CAR (extensions);
|
||||
if (scm_is_true (scm_string_suffix_p (extension, str,
|
||||
SCM_UNDEFINED, SCM_UNDEFINED,
|
||||
SCM_UNDEFINED, SCM_UNDEFINED)))
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -576,8 +575,7 @@ search_path (SCM path, SCM filename, SCM extensions, SCM require_exts,
|
|||
if (is_absolute_file_name (filename))
|
||||
{
|
||||
if ((scm_is_false (require_exts) ||
|
||||
scm_c_string_has_an_ext (filename_chars, filename_len,
|
||||
extensions))
|
||||
string_has_an_ext (filename, extensions))
|
||||
&& stat (filename_chars, stat_buf) == 0
|
||||
&& !(stat_buf->st_mode & S_IFDIR))
|
||||
result = filename;
|
||||
|
@ -595,8 +593,7 @@ search_path (SCM path, SCM filename, SCM extensions, SCM require_exts,
|
|||
if (*endp == '.')
|
||||
{
|
||||
if (scm_is_true (require_exts) &&
|
||||
!scm_c_string_has_an_ext (filename_chars, filename_len,
|
||||
extensions))
|
||||
!string_has_an_ext (filename, extensions))
|
||||
{
|
||||
/* This filename has an extension, but not one of the right
|
||||
ones... */
|
||||
|
|
|
@ -92,6 +92,8 @@
|
|||
#define SCM_NUM2ULONG_LONG_DEF(pos, arg, def) \
|
||||
(SCM_UNBNDP (arg) ? def : scm_to_ulong_long (arg))
|
||||
|
||||
#define SCM_NUM2SIZE(pos, arg) (scm_to_size_t (arg))
|
||||
|
||||
#define SCM_NUM2FLOAT(pos, arg) ((float) scm_to_double (arg))
|
||||
|
||||
#define SCM_NUM2DOUBLE(pos, arg) (scm_to_double (arg))
|
||||
|
@ -201,6 +203,11 @@
|
|||
cvar = SCM_NUM2LONG (pos, k); \
|
||||
} while (0)
|
||||
|
||||
#define SCM_VALIDATE_SIZE_COPY(pos, k, cvar) \
|
||||
do { \
|
||||
cvar = SCM_NUM2SIZE (pos, k); \
|
||||
} while (0)
|
||||
|
||||
#define SCM_VALIDATE_FLOAT_COPY(pos, k, cvar) \
|
||||
do { \
|
||||
cvar = SCM_NUM2FLOAT (pos, k); \
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue