OSDN Git Service

2006-08-14 Mark Wielaard <mark@klomp.org>
[pf3gnuchains/gcc-fork.git] / libjava / java / lang / natStringBuilder.cc
1 // Native methods for StringBuilder.
2
3 /* Copyright (C) 2005  Free Software Foundation
4
5    This file is part of libgcj.
6
7 This software is copyrighted work licensed under the terms of the
8 Libgcj License.  Please consult the file "LIBGCJ_LICENSE" for
9 details.  */
10
11 #include <config.h>
12 #include <gcj/cni.h>
13 #include <java/lang/StringBuilder.h>
14 #include <java/lang/String.h>
15
16 jboolean
17 java::lang::StringBuilder::regionMatches(jint offset, jstring other)
18 {
19   int len = other->count;
20   int index = 0;
21   jchar *sc = elements (value);
22   jchar *oc = _Jv_GetStringChars (other);
23   while (--len >= 0)
24     {
25       if (sc[offset++] != oc[index++])
26         return false;
27     }
28   return true;
29 }