From c51f00ea19cebb48e5f918eede4a10ac226d0822 Mon Sep 17 00:00:00 2001 From: tromey Date: Tue, 26 Dec 2000 00:24:01 +0000 Subject: 2000-12-24 Jeff Sturm * java/io/FileDescriptor.java: Initialize fd to -1. Remove default constructor. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@38485 138bc75d-0d04-0410-961f-82ee72b054a4 --- libjava/ChangeLog | 5 +++++ libjava/java/io/FileDescriptor.java | 13 ++++++------- 2 files changed, 11 insertions(+), 7 deletions(-) (limited to 'libjava') diff --git a/libjava/ChangeLog b/libjava/ChangeLog index 14caf093fe1..0fbd6b92032 100644 --- a/libjava/ChangeLog +++ b/libjava/ChangeLog @@ -1,3 +1,8 @@ +2000-12-24 Jeff Sturm + + * java/io/FileDescriptor.java: Initialize fd to -1. + Remove default constructor. + 2000-12-23 Joseph S. Myers * java/lang/mprec.h: Change C9X reference to refer to C99. diff --git a/libjava/java/io/FileDescriptor.java b/libjava/java/io/FileDescriptor.java index 51c6fd6c5b1..493f14cf280 100644 --- a/libjava/java/io/FileDescriptor.java +++ b/libjava/java/io/FileDescriptor.java @@ -49,11 +49,6 @@ public final class FileDescriptor fd = open (path, mode); } - public FileDescriptor () - { - fd = -1; - } - native int open (String path, int mode) throws FileNotFoundException; native void write (int b) throws IOException; native void write (byte[] b, int offset, int len) @@ -84,6 +79,10 @@ public final class FileDescriptor fd = desc; } - // System's notion of file descriptor. - private int fd; + // System's notion of file descriptor. It might seem redundant to + // initialize this given that it is reassigned in the constructors. + // However, this is necessary because if open() throws an exception + // we want to make sure this has the value -1. This is the most + // efficient way to accomplish that. + private int fd = -1; } -- cgit v1.2.3