Bug 1030183 - move NewStringCopy* definitions to avoid unified-build bustage (r=jandem)

--HG--
extra : rebase_source : 42bf9a3f72cbf9a2316b4ec75104e0a50506f2ed
This commit is contained in:
Luke Wagner 2014-06-25 11:39:15 -05:00
parent 3980926d42
commit db94658cbf
2 changed files with 36 additions and 67 deletions

View File

@ -4507,48 +4507,8 @@ NewStringCopyN<CanGC>(ThreadSafeContext *cx, const Latin1Char *s, size_t n);
template JSFlatString *
NewStringCopyN<NoGC>(ThreadSafeContext *cx, const Latin1Char *s, size_t n);
template <>
JSFlatString *
NewStringCopyN<CanGC>(ThreadSafeContext *cx, const char *s, size_t n)
{
return NewStringCopyN<CanGC>(cx, reinterpret_cast<const Latin1Char *>(s), n);
}
template <>
JSFlatString *
NewStringCopyN<NoGC>(ThreadSafeContext *cx, const char *s, size_t n)
{
return NewStringCopyN<NoGC>(cx, reinterpret_cast<const Latin1Char *>(s), n);
}
} /* namespace js */
template <AllowGC allowGC>
JSFlatString *
js::NewStringCopyZ(ExclusiveContext *cx, const jschar *s)
{
return NewStringCopyN<allowGC>(cx, s, js_strlen(s));
}
template JSFlatString *
js::NewStringCopyZ<CanGC>(ExclusiveContext *cx, const jschar *s);
template JSFlatString *
js::NewStringCopyZ<NoGC>(ExclusiveContext *cx, const jschar *s);
template <AllowGC allowGC>
JSFlatString *
js::NewStringCopyZ(ThreadSafeContext *cx, const char *s)
{
return NewStringCopyN<allowGC>(cx, s, strlen(s));
}
template JSFlatString *
js::NewStringCopyZ<CanGC>(ThreadSafeContext *cx, const char *s);
template JSFlatString *
js::NewStringCopyZ<NoGC>(ThreadSafeContext *cx, const char *s);
const char *
js_ValueToPrintable(JSContext *cx, const Value &vArg, JSAutoByteString *bytes, bool asSource)
{

View File

@ -105,6 +105,25 @@ extern const char *
js_ValueToPrintable(JSContext *cx, const js::Value &,
JSAutoByteString *bytes, bool asSource = false);
extern size_t
js_strlen(const jschar *s);
extern int32_t
js_strcmp(const jschar *lhs, const jschar *rhs);
template <typename CharT>
extern const CharT *
js_strchr_limit(const CharT *s, jschar c, const CharT *limit);
static MOZ_ALWAYS_INLINE void
js_strncpy(jschar *dst, const jschar *src, size_t nelem)
{
return mozilla::PodCopy(dst, src, nelem);
}
extern jschar *
js_strdup(js::ThreadSafeContext *cx, const jschar *s);
namespace js {
/* GC-allocate a string descriptor for the given malloc-allocated chars. */
@ -120,6 +139,13 @@ template <js::AllowGC allowGC, typename CharT>
extern JSFlatString *
NewStringCopyN(js::ThreadSafeContext *cx, const CharT *s, size_t n);
template <js::AllowGC allowGC>
inline JSFlatString *
NewStringCopyN(ThreadSafeContext *cx, const char *s, size_t n)
{
return NewStringCopyN<allowGC>(cx, reinterpret_cast<const Latin1Char *>(s), n);
}
/* Like NewStringCopyN, but doesn't try to deflate to Latin1. */
template <js::AllowGC allowGC, typename CharT>
extern JSFlatString *
@ -127,12 +153,18 @@ NewStringCopyNDontDeflate(js::ThreadSafeContext *cx, const CharT *s, size_t n);
/* Copy a C string and GC-allocate a descriptor for it. */
template <js::AllowGC allowGC>
extern JSFlatString *
NewStringCopyZ(js::ExclusiveContext *cx, const jschar *s);
inline JSFlatString *
NewStringCopyZ(js::ExclusiveContext *cx, const jschar *s)
{
return NewStringCopyN<allowGC>(cx, s, js_strlen(s));
}
template <js::AllowGC allowGC>
extern JSFlatString *
NewStringCopyZ(js::ThreadSafeContext *cx, const char *s);
inline JSFlatString *
NewStringCopyZ(js::ThreadSafeContext *cx, const char *s)
{
return NewStringCopyN<allowGC>(cx, s, strlen(s));
}
/*
* Convert a non-string value to a string, returning null after reporting an
@ -223,29 +255,6 @@ StringFindPattern(JSLinearString *text, JSLinearString *pat, size_t start);
extern bool
StringHasRegExpMetaChars(JSLinearString *str);
} /* namespace js */
extern size_t
js_strlen(const jschar *s);
extern int32_t
js_strcmp(const jschar *lhs, const jschar *rhs);
template <typename CharT>
extern const CharT *
js_strchr_limit(const CharT *s, jschar c, const CharT *limit);
static MOZ_ALWAYS_INLINE void
js_strncpy(jschar *dst, const jschar *src, size_t nelem)
{
return mozilla::PodCopy(dst, src, nelem);
}
extern jschar *
js_strdup(js::ThreadSafeContext *cx, const jschar *s);
namespace js {
template <typename Char1, typename Char2>
inline bool
EqualChars(const Char1 *s1, const Char2 *s2, size_t len);