Cross Reference: outStream.c
xref
: /
openjdk7
/
jdk
/
src
/
share
/
back
/
outStream.c
Home
History
Annotate
Line#
Navigate
Download
Search
only in
./
outStream.c revision 0
0
N/A
/*
0
N/A
* Copyright 1998-2005 Sun Microsystems, Inc. All Rights Reserved.
0
N/A
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0
N/A
*
0
N/A
* This code is free software; you can redistribute it
and
/
or
modify it
0
N/A
* under the terms of the GNU General Public License version 2 only, as
0
N/A
* published by the Free Software Foundation. Sun designates this
0
N/A
* particular file as subject to the "Classpath" exception as provided
0
N/A
* by Sun in the LICENSE file that accompanied this code.
0
N/A
*
0
N/A
* This code is distributed in the hope that it will be useful, but WITHOUT
0
N/A
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0
N/A
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
0
N/A
* version 2 for more details (a copy is included in the LICENSE file that
0
N/A
* accompanied this code).
0
N/A
*
0
N/A
* You should have received a copy of the GNU General Public License version
0
N/A
* 2 along with this work; if not, write to the Free Software Foundation,
0
N/A
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0
N/A
*
0
N/A
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
0
N/A
* CA 95054 USA or visit
www.sun.c
om if you need additional information or
0
N/A
* have any questions.
0
N/A
*/
0
N/A
0
N/A
#
include
"
util.h
"
0
N/A
#
include
"
stream.h
"
0
N/A
#
include
"
outStream.h
"
0
N/A
#
include
"
inStream.h
"
0
N/A
#
include
"
transport.h
"
0
N/A
#
include
"
commonRef.h
"
0
N/A
#
include
"
bag.h
"
0
N/A
#
include
"
FrameID.h
"
0
N/A
0
N/A
#
define
INITIAL_ID_ALLOC
50
0
N/A
#
define
SMALLEST
(a, b) ((a) < (b)) ? (a) : (b)
0
N/A
0
N/A
static
void
0
N/A
commonInit
(
PacketOutputStream
*
stream
)
0
N/A
{
0
N/A
stream
->
current
= &
stream
->
initialSegment
[0];
0
N/A
stream
->
left
=
sizeof
(
stream
->
initialSegment
);
0
N/A
stream
->
segment
= &
stream
->
firstSegment
;
0
N/A
stream
->
segment
->
length
= 0;
0
N/A
stream
->
segment
->
data
= &
stream
->
initialSegment
[0];
0
N/A
stream
->
segment
->
next
=
NULL
;
0
N/A
stream
->
error
=
JDWP_ERROR
(
NONE
);
0
N/A
stream
->
sent
=
JNI_FALSE
;
0
N/A
stream
->
ids
=
bagCreateBag
(
sizeof
(
jlong
),
INITIAL_ID_ALLOC
);
0
N/A
if
(
stream
->
ids
==
NULL
) {
0
N/A
stream
->
error
=
JDWP_ERROR
(
OUT_OF_MEMORY
);
0
N/A
}
0
N/A
}
0
N/A
0
N/A
void
0
N/A
outStream_initCommand
(
PacketOutputStream
*
stream
,
jint
id
,
0
N/A
jbyte
flags
,
jbyte
commandSet
,
jbyte
command
)
0
N/A
{
0
N/A
commonInit
(
stream
);
0
N/A
0
N/A
/*
0
N/A
* Command-specific initialization
0
N/A
*/
0
N/A
stream
->
packet
.
type
.
cmd
.
id
=
id
;
0
N/A
stream
->
packet
.
type
.
cmd
.
cmdSet
=
commandSet
;
0
N/A
stream
->
packet
.
type
.
cmd
.
cmd
=
command
;
0
N/A
0
N/A
stream
->
packet
.
type
.
cmd
.
flags
=
flags
;
0
N/A
}
0
N/A
0
N/A
void
0
N/A
outStream_initReply
(
PacketOutputStream
*
stream
,
jint
id
)
0
N/A
{
0
N/A
commonInit
(
stream
);
0
N/A
0
N/A
/*
0
N/A
* Reply-specific initialization
0
N/A
*/
0
N/A
stream
->
packet
.
type
.
reply
.
id
=
id
;
0
N/A
stream
->
packet
.
type
.
reply
.
errorCode
=
0x0
;
0
N/A
stream
->
packet
.
type
.
cmd
.
flags
= (
jbyte
)
JDWPTRANSPORT_FLAGS_REPLY
;
0
N/A
}
0
N/A
0
N/A
jint
0
N/A
outStream_id
(
PacketOutputStream
*
stream
)
0
N/A
{
0
N/A
return
stream
->
packet
.
type
.
cmd
.
id
;
0
N/A
}
0
N/A
0
N/A
jbyte
0
N/A
outStream_command
(
PacketOutputStream
*
stream
)
0
N/A
{
0
N/A
/* Only makes sense for commands */
0
N/A
JDI_ASSERT
(!(
stream
->
packet
.
type
.
cmd
.
flags
&
JDWPTRANSPORT_FLAGS_REPLY
));
0
N/A
return
stream
->
packet
.
type
.
cmd
.
cmd
;
0
N/A
}
0
N/A
0
N/A
static
jdwpError
0
N/A
writeBytes
(
PacketOutputStream
*
stream
,
void
*
source
,
int
size
)
0
N/A
{
0
N/A
jbyte
*
bytes
= (
jbyte
*)
source
;
0
N/A
0
N/A
if
(
stream
->
error
) {
0
N/A
return
stream
->
error
;
0
N/A
}
0
N/A
while
(
size
> 0) {
0
N/A
jint
count
;
0
N/A
if
(
stream
->
left
== 0) {
0
N/A
jint
segSize
=
SMALLEST
(
2
*
stream
->
segment
->
length
,
MAX_SEGMENT_SIZE
);
0
N/A
jbyte
*
newSeg
=
jvmtiAllocate
(
segSize
);
0
N/A
struct
PacketData
*
newHeader
=
jvmtiAllocate
(
sizeof
(*
newHeader
));
0
N/A
if
((
newSeg
==
NULL
) || (
newHeader
==
NULL
)) {
0
N/A
jvmtiDeallocate
(
newSeg
);
0
N/A
jvmtiDeallocate
(
newHeader
);
0
N/A
stream
->
error
=
JDWP_ERROR
(
OUT_OF_MEMORY
);
0
N/A
return
stream
->
error
;
0
N/A
}
0
N/A
newHeader
->
length
= 0;
0
N/A
newHeader
->
data
=
newSeg
;
0
N/A
newHeader
->
next
=
NULL
;
0
N/A
stream
->
segment
->
next
=
newHeader
;
0
N/A
stream
->
segment
=
newHeader
;
0
N/A
stream
->
current
=
newHeader
->
data
;
0
N/A
stream
->
left
=
segSize
;
0
N/A
}
0
N/A
count
=
SMALLEST
(
size
,
stream
->
left
);
0
N/A
(
void
)
memcpy
(
stream
->
current
,
bytes
,
count
);
0
N/A
stream
->
current
+=
count
;
0
N/A
stream
->
left
-=
count
;
0
N/A
stream
->
segment
->
length
+=
count
;
0
N/A
size
-=
count
;
0
N/A
bytes
+=
count
;
0
N/A
}
0
N/A
return
JDWP_ERROR
(
NONE
);
0
N/A
}
0
N/A
0
N/A
jdwpError
0
N/A
outStream_writeBoolean
(
PacketOutputStream
*
stream
,
jboolean
val
)
0
N/A
{
0
N/A
jbyte
byte
= (
val
!= 0) ?
1
: 0;
0
N/A
return
writeBytes
(
stream
, &
byte
,
sizeof
(
byte
));
0
N/A
}
0
N/A
0
N/A
jdwpError
0
N/A
outStream_writeByte
(
PacketOutputStream
*
stream
,
jbyte
val
)
0
N/A
{
0
N/A
return
writeBytes
(
stream
, &
val
,
sizeof
(
val
));
0
N/A
}
0
N/A
0
N/A
jdwpError
0
N/A
outStream_writeChar
(
PacketOutputStream
*
stream
,
jchar
val
)
0
N/A
{
0
N/A
val
=
HOST_TO_JAVA_CHAR
(
val
);
0
N/A
return
writeBytes
(
stream
, &
val
,
sizeof
(
val
));
0
N/A
}
0
N/A
0
N/A
jdwpError
0
N/A
outStream_writeShort
(
PacketOutputStream
*
stream
,
jshort
val
)
0
N/A
{
0
N/A
val
=
HOST_TO_JAVA_SHORT
(
val
);
0
N/A
return
writeBytes
(
stream
, &
val
,
sizeof
(
val
));
0
N/A
}
0
N/A
0
N/A
jdwpError
0
N/A
outStream_writeInt
(
PacketOutputStream
*
stream
,
jint
val
)
0
N/A
{
0
N/A
val
=
HOST_TO_JAVA_INT
(
val
);
0
N/A
return
writeBytes
(
stream
, &
val
,
sizeof
(
val
));
0
N/A
}
0
N/A
0
N/A
jdwpError
0
N/A
outStream_writeLong
(
PacketOutputStream
*
stream
,
jlong
val
)
0
N/A
{
0
N/A
val
=
HOST_TO_JAVA_LONG
(
val
);
0
N/A
return
writeBytes
(
stream
, &
val
,
sizeof
(
val
));
0
N/A
}
0
N/A
0
N/A
jdwpError
0
N/A
outStream_writeFloat
(
PacketOutputStream
*
stream
,
jfloat
val
)
0
N/A
{
0
N/A
val
=
HOST_TO_JAVA_FLOAT
(
val
);
0
N/A
return
writeBytes
(
stream
, &
val
,
sizeof
(
val
));
0
N/A
}
0
N/A
0
N/A
jdwpError
0
N/A
outStream_writeDouble
(
PacketOutputStream
*
stream
,
jdouble
val
)
0
N/A
{
0
N/A
val
=
HOST_TO_JAVA_DOUBLE
(
val
);
0
N/A
return
writeBytes
(
stream
, &
val
,
sizeof
(
val
));
0
N/A
}
0
N/A
0
N/A
jdwpError
0
N/A
outStream_writeObjectTag
(
JNIEnv
*
env
,
PacketOutputStream
*
stream
,
jobject
val
)
0
N/A
{
0
N/A
return
outStream_writeByte
(
stream
,
specificTypeKey
(
env
,
val
));
0
N/A
}
0
N/A
0
N/A
jdwpError
0
N/A
outStream_writeObjectRef
(
JNIEnv
*
env
,
PacketOutputStream
*
stream
,
jobject
val
)
0
N/A
{
0
N/A
jlong
id
;
0
N/A
jlong
*
idPtr
;
0
N/A
0
N/A
if
(
stream
->
error
) {
0
N/A
return
stream
->
error
;
0
N/A
}
0
N/A
0
N/A
if
(
val
==
NULL
) {
0
N/A
id
=
NULL_OBJECT_ID
;
0
N/A
}
else
{
0
N/A
/* Convert the object to an object id */
0
N/A
id
=
commonRef_refToID
(
env
,
val
);
0
N/A
if
(
id
==
NULL_OBJECT_ID
) {
0
N/A
stream
->
error
=
JDWP_ERROR
(
OUT_OF_MEMORY
);
0
N/A
return
stream
->
error
;
0
N/A
}
0
N/A
0
N/A
/* Track the common ref in case we need to release it on a future error */
0
N/A
idPtr
=
bagAdd
(
stream
->
ids
);
0
N/A
if
(
idPtr
==
NULL
) {
0
N/A
commonRef_release
(
env
,
id
);
0
N/A
stream
->
error
=
JDWP_ERROR
(
OUT_OF_MEMORY
);
0
N/A
return
stream
->
error
;
0
N/A
}
else
{
0
N/A
*
idPtr
=
id
;
0
N/A
}
0
N/A
0
N/A
/* Add the encoded object id to the stream */
0
N/A
id
=
HOST_TO_JAVA_LONG
(
id
);
0
N/A
}
0
N/A
0
N/A
return
writeBytes
(
stream
, &
id
,
sizeof
(
id
));
0
N/A
}
0
N/A
0
N/A
jdwpError
0
N/A
outStream_writeFrameID
(
PacketOutputStream
*
stream
,
FrameID
val
)
0
N/A
{
0
N/A
/*
0
N/A
* Not good - we're writing a pointer as a jint. Need
0
N/A
* to write as a jlong if sizeof(FrameID) == 8.
0
N/A
*/
0
N/A
if
(
sizeof
(
FrameID
) ==
8
) {
0
N/A
/*LINTED*/
0
N/A
return
outStream_writeLong
(
stream
, (
jlong
)
val
);
0
N/A
}
else
{
0
N/A
/*LINTED*/
0
N/A
return
outStream_writeInt
(
stream
, (
jint
)
val
);
0
N/A
}
0
N/A
}
0
N/A
0
N/A
jdwpError
0
N/A
outStream_writeMethodID
(
PacketOutputStream
*
stream
,
jmethodID
val
)
0
N/A
{
0
N/A
/*
0
N/A
* Not good - we're writing a pointer as a jint. Need
0
N/A
* to write as a jlong if sizeof(jmethodID) == 8.
0
N/A
*/
0
N/A
if
(
sizeof
(
jmethodID
) ==
8
) {
0
N/A
/*LINTED*/
0
N/A
return
outStream_writeLong
(
stream
, (
jlong
)(
intptr_t
)
val
);
0
N/A
}
else
{
0
N/A
/*LINTED*/
0
N/A
return
outStream_writeInt
(
stream
, (
jint
)(
intptr_t
)
val
);
0
N/A
}
0
N/A
}
0
N/A
0
N/A
jdwpError
0
N/A
outStream_writeFieldID
(
PacketOutputStream
*
stream
,
jfieldID
val
)
0
N/A
{
0
N/A
/*
0
N/A
* Not good - we're writing a pointer as a jint. Need
0
N/A
* to write as a jlong if sizeof(jfieldID) == 8.
0
N/A
*/
0
N/A
if
(
sizeof
(
jfieldID
) ==
8
) {
0
N/A
/*LINTED*/
0
N/A
return
outStream_writeLong
(
stream
, (
jlong
)(
intptr_t
)
val
);
0
N/A
}
else
{
0
N/A
/*LINTED*/
0
N/A
return
outStream_writeInt
(
stream
, (
jint
)(
intptr_t
)
val
);
0
N/A
}
0
N/A
}
0
N/A
0
N/A
jdwpError
0
N/A
outStream_writeLocation
(
PacketOutputStream
*
stream
,
jlocation
val
)
0
N/A
{
0
N/A
return
outStream_writeLong
(
stream
, (
jlong
)
val
);
0
N/A
}
0
N/A
0
N/A
jdwpError
0
N/A
outStream_writeByteArray
(
PacketOutputStream
*
stream
,
jint
length
,
0
N/A
jbyte
*
bytes
)
0
N/A
{
0
N/A
(
void
)
outStream_writeInt
(
stream
,
length
);
0
N/A
return
writeBytes
(
stream
,
bytes
,
length
);
0
N/A
}
0
N/A
0
N/A
jdwpError
0
N/A
outStream_writeString
(
PacketOutputStream
*
stream
,
char
*
string
)
0
N/A
{
0
N/A
jdwpError
error
;
0
N/A
jint
length
;
0
N/A
0
N/A
/* Options utf8=y/n controls if we want Standard UTF-8 or Modified */
0
N/A
if
(
gdata
->
modifiedUtf8
) {
0
N/A
length
= (
int
)
strlen
(
string
);
0
N/A
(
void
)
outStream_writeInt
(
stream
,
length
);
0
N/A
error
=
writeBytes
(
stream
, (
jbyte
*)
string
,
length
);
0
N/A
}
else
{
0
N/A
jint
new_length
;
0
N/A
0
N/A
length
= (
int
)
strlen
(
string
);
0
N/A
new_length
= (
gdata
->
npt
->
utf8mToUtf8sLength
)
0
N/A
(
gdata
->
npt
->
utf
, (
jbyte
*)
string
,
length
);
0
N/A
if
(
new_length
==
length
) {
0
N/A
(
void
)
outStream_writeInt
(
stream
,
length
);
0
N/A
error
=
writeBytes
(
stream
, (
jbyte
*)
string
,
length
);
0
N/A
}
else
{
0
N/A
char
*
new_string
;
0
N/A
0
N/A
new_string
=
jvmtiAllocate
(
new_length
+
1
);
0
N/A
(
gdata
->
npt
->
utf8mToUtf8s
)
0
N/A
(
gdata
->
npt
->
utf
, (
jbyte
*)
string
,
length
,
0
N/A
(
jbyte
*)
new_string
,
new_length
);
0
N/A
(
void
)
outStream_writeInt
(
stream
,
new_length
);
0
N/A
error
=
writeBytes
(
stream
, (
jbyte
*)
new_string
,
new_length
);
0
N/A
jvmtiDeallocate
(
new_string
);
0
N/A
}
0
N/A
}
0
N/A
return
error
;
0
N/A
}
0
N/A
0
N/A
jdwpError
0
N/A
outStream_writeValue
(
JNIEnv
*
env
,
PacketOutputStream
*
out
,
0
N/A
jbyte
typeKey
,
jvalue
value
)
0
N/A
{
0
N/A
if
(
typeKey
==
JDWP_TAG
(
OBJECT
)) {
0
N/A
(
void
)
outStream_writeByte
(
out
,
specificTypeKey
(
env
,
value
.l));
0
N/A
}
else
{
0
N/A
(
void
)
outStream_writeByte
(
out
,
typeKey
);
0
N/A
}
0
N/A
if
(
isObjectTag
(
typeKey
)) {
0
N/A
(
void
)
outStream_writeObjectRef
(
env
,
out
,
value
.l);
0
N/A
}
else
{
0
N/A
switch
(
typeKey
) {
0
N/A
case
JDWP_TAG
(
BYTE
):
0
N/A
return
outStream_writeByte
(
out
,
value
.b);
0
N/A
0
N/A
case
JDWP_TAG
(
CHAR
):
0
N/A
return
outStream_writeChar
(
out
,
value
.c);
0
N/A
0
N/A
case
JDWP_TAG
(
FLOAT
):
0
N/A
return
outStream_writeFloat
(
out
,
value
.f);
0
N/A
0
N/A
case
JDWP_TAG
(
DOUBLE
):
0
N/A
return
outStream_writeDouble
(
out
,
value
.d);
0
N/A
0
N/A
case
JDWP_TAG
(
INT
):
0
N/A
return
outStream_writeInt
(
out
,
value
.i);
0
N/A
0
N/A
case
JDWP_TAG
(
LONG
):
0
N/A
return
outStream_writeLong
(
out
,
value
.j);
0
N/A
0
N/A
case
JDWP_TAG
(
SHORT
):
0
N/A
return
outStream_writeShort
(
out
,
value
.s);
0
N/A
0
N/A
case
JDWP_TAG
(
BOOLEAN
):
0
N/A
return
outStream_writeBoolean
(
out
,
value
.z);
0
N/A
0
N/A
case
JDWP_TAG
(
VOID
):
/* happens with function return values */
0
N/A
/* write nothing */
0
N/A
return
JDWP_ERROR
(
NONE
);
0
N/A
0
N/A
default
:
0
N/A
EXIT_ERROR
(
AGENT_ERROR_INVALID_OBJECT
,
"Invalid type key"
);
0
N/A
break
;
0
N/A
}
0
N/A
}
0
N/A
return
JDWP_ERROR
(
NONE
);
0
N/A
}
0
N/A
0
N/A
jdwpError
0
N/A
outStream_skipBytes
(
PacketOutputStream
*
stream
,
jint
count
)
0
N/A
{
0
N/A
int
i;
0
N/A
for
(i = 0; i <
count
; i++) {
0
N/A
(
void
)
outStream_writeByte
(
stream
, 0);
0
N/A
}
0
N/A
return
stream
->
error
;
0
N/A
}
0
N/A
0
N/A
jdwpError
0
N/A
outStream_error
(
PacketOutputStream
*
stream
)
0
N/A
{
0
N/A
return
stream
->
error
;
0
N/A
}
0
N/A
0
N/A
void
0
N/A
outStream_setError
(
PacketOutputStream
*
stream
,
jdwpError
error
)
0
N/A
{
0
N/A
if
(
stream
->
error
==
JDWP_ERROR
(
NONE
)) {
0
N/A
stream
->
error
=
error
;
0
N/A
LOG_MISC
((
"outStream_setError error=%s(%d)"
,
jdwpErrorText
(
error
),
error
));
0
N/A
}
0
N/A
}
0
N/A
0
N/A
static
jint
0
N/A
outStream_send
(
PacketOutputStream
*
stream
) {
0
N/A
0
N/A
jint
rc
;
0
N/A
jint
len
= 0;
0
N/A
PacketData
*
segment
;
0
N/A
jbyte
*
data
, *
posP
;
0
N/A
0
N/A
/*
0
N/A
* If there's only 1 segment then we just send the
0
N/A
* packet.
0
N/A
*/
0
N/A
if
(
stream
->
firstSegment
.
next
==
NULL
) {
0
N/A
stream
->
packet
.
type
.
cmd
.
len
=
11
+
stream
->
firstSegment
.
length
;
0
N/A
stream
->
packet
.
type
.
cmd
.
data
=
stream
->
firstSegment
.
data
;
0
N/A
rc
=
transport_sendPacket
(&
stream
->
packet
);
0
N/A
return
rc
;
0
N/A
}
0
N/A
0
N/A
/*
0
N/A
* Multiple segments
0
N/A
*/
0
N/A
len
= 0;
0
N/A
segment
= (
PacketData
*)&(
stream
->
firstSegment
);
0
N/A
do
{
0
N/A
len
+=
segment
->
length
;
0
N/A
segment
=
segment
->
next
;
0
N/A
}
while
(
segment
!=
NULL
);
0
N/A
0
N/A
data
=
jvmtiAllocate
(
len
);
0
N/A
if
(
data
==
NULL
) {
0
N/A
return
JDWP_ERROR
(
OUT_OF_MEMORY
);
0
N/A
}
0
N/A
0
N/A
posP
=
data
;
0
N/A
segment
= (
PacketData
*)&(
stream
->
firstSegment
);
0
N/A
while
(
segment
!=
NULL
) {
0
N/A
(
void
)
memcpy
(
posP
,
segment
->
data
,
segment
->
length
);
0
N/A
posP
+=
segment
->
length
;
0
N/A
segment
=
segment
->
next
;
0
N/A
}
0
N/A
0
N/A
stream
->
packet
.
type
.
cmd
.
len
=
11
+
len
;
0
N/A
stream
->
packet
.
type
.
cmd
.
data
=
data
;
0
N/A
rc
=
transport_sendPacket
(&
stream
->
packet
);
0
N/A
stream
->
packet
.
type
.
cmd
.
data
=
NULL
;
0
N/A
jvmtiDeallocate
(
data
);
0
N/A
0
N/A
return
rc
;
0
N/A
}
0
N/A
0
N/A
void
0
N/A
outStream_sendReply
(
PacketOutputStream
*
stream
)
0
N/A
{
0
N/A
jint
rc
;
0
N/A
if
(
stream
->
error
) {
0
N/A
/*
0
N/A
* Don't send any collected stream data on an error reply
0
N/A
*/
0
N/A
stream
->
packet
.
type
.
reply
.
len
= 0;
0
N/A
stream
->
packet
.
type
.
reply
.
errorCode
= (
jshort
)
stream
->
error
;
0
N/A
}
0
N/A
rc
=
outStream_send
(
stream
);
0
N/A
if
(
rc
== 0) {
0
N/A
stream
->
sent
=
JNI_TRUE
;
0
N/A
}
0
N/A
}
0
N/A
0
N/A
void
0
N/A
outStream_sendCommand
(
PacketOutputStream
*
stream
)
0
N/A
{
0
N/A
jint
rc
;
0
N/A
if
(!
stream
->
error
) {
0
N/A
rc
=
outStream_send
(
stream
);
0
N/A
if
(
rc
== 0) {
0
N/A
stream
->
sent
=
JNI_TRUE
;
0
N/A
}
0
N/A
}
0
N/A
}
0
N/A
0
N/A
0
N/A
static
jboolean
0
N/A
releaseID
(
void
*
elementPtr
,
void
*
arg
)
0
N/A
{
0
N/A
jlong
*
idPtr
=
elementPtr
;
0
N/A
commonRef_release
(
getEnv
(), *
idPtr
);
0
N/A
return
JNI_TRUE
;
0
N/A
}
0
N/A
0
N/A
void
0
N/A
outStream_destroy
(
PacketOutputStream
*
stream
)
0
N/A
{
0
N/A
struct
PacketData
*
next
;
0
N/A
0
N/A
if
(
stream
->
error
|| !
stream
->
sent
) {
0
N/A
(
void
)
bagEnumerateOver
(
stream
->
ids
,
releaseID
,
NULL
);
0
N/A
}
0
N/A
0
N/A
next
=
stream
->
firstSegment
.
next
;
0
N/A
while
(
next
!=
NULL
) {
0
N/A
struct
PacketData
*p =
next
;
0
N/A
next
= p->
next
;
0
N/A
jvmtiDeallocate
(p->
data
);
0
N/A
jvmtiDeallocate
(p);
0
N/A
}
0
N/A
bagDestroyBag
(
stream
->
ids
);
0
N/A
}