summaryrefslogtreecommitdiff
path: root/libjava/java/lang/natStringBuilder.cc
blob: e2c8c29f6e3974c4b7f8dbbbcbdee728abb25caa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
// Native methods for StringBuilder.

/* Copyright (C) 2005  Free Software Foundation

   This file is part of libgcj.

This software is copyrighted work licensed under the terms of the
Libgcj License.  Please consult the file "LIBGCJ_LICENSE" for
details.  */

#include <config.h>
#include <gcj/cni.h>
#include <java/lang/StringBuilder.h>
#include <java/lang/String.h>

jboolean
java::lang::StringBuilder::regionMatches(jint offset, jstring other)
{
  int len = other->count;
  int index = 0;
  jchar *sc = elements (value);
  jchar *oc = _Jv_GetStringChars (other);
  while (--len >= 0)
    {
      if (sc[offset++] != oc[index++])
	return false;
    }
  return true;
}