зеркало из https://github.com/mozilla/gecko-dev.git
Bug 890192 (part 3) - Slim down jsstrinlines.h. r=terrence.
--HG-- extra : rebase_source : 554a1eb91ea60130c2aa3c5581d6b69831a57cfc
This commit is contained in:
Родитель
56fe48dd1d
Коммит
8c57fd2dcd
|
@ -47,6 +47,35 @@ ConcatStrings(ThreadSafeContext *cx,
|
||||||
typename MaybeRooted<JSString*, allowGC>::HandleType left,
|
typename MaybeRooted<JSString*, allowGC>::HandleType left,
|
||||||
typename MaybeRooted<JSString*, allowGC>::HandleType right);
|
typename MaybeRooted<JSString*, allowGC>::HandleType right);
|
||||||
|
|
||||||
|
// Return s advanced past any Unicode white space characters.
|
||||||
|
static inline const jschar *
|
||||||
|
SkipSpace(const jschar *s, const jschar *end)
|
||||||
|
{
|
||||||
|
JS_ASSERT(s <= end);
|
||||||
|
|
||||||
|
while (s < end && unicode::IsSpace(*s))
|
||||||
|
s++;
|
||||||
|
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Return less than, equal to, or greater than zero depending on whether
|
||||||
|
// s1 is less than, equal to, or greater than s2.
|
||||||
|
inline bool
|
||||||
|
CompareChars(const jschar *s1, size_t l1, const jschar *s2, size_t l2, int32_t *result)
|
||||||
|
{
|
||||||
|
size_t n = Min(l1, l2);
|
||||||
|
for (size_t i = 0; i < n; i++) {
|
||||||
|
if (int32_t cmp = s1[i] - s2[i]) {
|
||||||
|
*result = cmp;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
*result = (int32_t)(l1 - l2);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
} /* namespace js */
|
} /* namespace js */
|
||||||
|
|
||||||
extern JSString * JS_FASTCALL
|
extern JSString * JS_FASTCALL
|
||||||
|
@ -157,9 +186,6 @@ ToString(JSContext *cx, JS::HandleValue v)
|
||||||
inline bool
|
inline bool
|
||||||
ValueToStringBuffer(JSContext *cx, const Value &v, StringBuffer &sb);
|
ValueToStringBuffer(JSContext *cx, const Value &v, StringBuffer &sb);
|
||||||
|
|
||||||
} /* namespace js */
|
|
||||||
|
|
||||||
namespace js {
|
|
||||||
/*
|
/*
|
||||||
* Convert a value to its source expression, returning null after reporting
|
* Convert a value to its source expression, returning null after reporting
|
||||||
* an error, otherwise returning a new string reference.
|
* an error, otherwise returning a new string reference.
|
||||||
|
|
|
@ -7,10 +7,11 @@
|
||||||
#ifndef jsstrinlines_h
|
#ifndef jsstrinlines_h
|
||||||
#define jsstrinlines_h
|
#define jsstrinlines_h
|
||||||
|
|
||||||
|
#include "jsstr.h"
|
||||||
|
|
||||||
#include "mozilla/Attributes.h"
|
#include "mozilla/Attributes.h"
|
||||||
|
|
||||||
#include "jsatom.h"
|
#include "jsatom.h"
|
||||||
#include "jsstr.h"
|
|
||||||
|
|
||||||
#include "jscntxtinlines.h"
|
#include "jscntxtinlines.h"
|
||||||
#include "jsgcinlines.h"
|
#include "jsgcinlines.h"
|
||||||
|
@ -89,39 +90,6 @@ class StringSegmentRange
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
|
||||||
* Return s advanced past any Unicode white space characters.
|
|
||||||
*/
|
|
||||||
static inline const jschar *
|
|
||||||
SkipSpace(const jschar *s, const jschar *end)
|
|
||||||
{
|
|
||||||
JS_ASSERT(s <= end);
|
|
||||||
|
|
||||||
while (s < end && unicode::IsSpace(*s))
|
|
||||||
s++;
|
|
||||||
|
|
||||||
return s;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Return less than, equal to, or greater than zero depending on whether
|
|
||||||
* s1 is less than, equal to, or greater than s2.
|
|
||||||
*/
|
|
||||||
inline bool
|
|
||||||
CompareChars(const jschar *s1, size_t l1, const jschar *s2, size_t l2, int32_t *result)
|
|
||||||
{
|
|
||||||
size_t n = Min(l1, l2);
|
|
||||||
for (size_t i = 0; i < n; i++) {
|
|
||||||
if (int32_t cmp = s1[i] - s2[i]) {
|
|
||||||
*result = cmp;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
*result = (int32_t)(l1 - l2);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
} /* namespace js */
|
} /* namespace js */
|
||||||
|
|
||||||
#endif /* jsstrinlines_h */
|
#endif /* jsstrinlines_h */
|
||||||
|
|
Загрузка…
Ссылка в новой задаче