This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
Re: [patch] [gui] warning patrol in gtk-peer
- From: Thomas Fitzsimmons <fitzsim at redhat dot com>
- To: Mark Wielaard <mark at klomp dot org>
- Cc: Andreas Tobler <toa at pop dot agri dot ch>, Java Patches <java-patches at gcc dot gnu dot org>
- Date: Thu, 21 Oct 2004 16:59:00 -0400
- Subject: Re: [patch] [gui] warning patrol in gtk-peer
- References: <4177DD17.1000104@pop.agri.ch> <1098388714.1115.6.camel@localhost>
On Thu, 2004-10-21 at 15:58, Mark Wielaard wrote:
> Hi,
>
> On Thu, 2004-10-21 at 18:00, Andreas Tobler wrote:
> > Hello all,
> >
> > the following patch cleans up a few warnings from unused variables.
> >
> > ok for gui?
>
> I cannot approve it. But in general anything goes for the gui branch,
> And I think this is actually obvious.
>
> I would do one little thing different though.
>
> > * jni/gtk-peer/gnu_java_awt_peer_gtk_GtkFileDialogPeer.c
> > (Java_gnu_java_awt_peer_gtk_GtkFileDialogPeer_nativeSetFilenameFilter):
> > Likewise.
> > (filenameFilterCallback): Remove unused var.
> > (handle_response): Initialize str_filename.
>
> You initialize str_filename in the definition. But we can also make sure
> that it is always defined in the function body. The code first checks
> for responseId == GTK_RESPONSE_OK, GTK_RESPONSE_CANCEL or
> GTK_RESPONSE_DELETE_EVENT. Then it handles GTK_RESPONSE_DELETE_EVENT and
> returns. So the following if-then-else block could also be written as:
>
> @@ -252,7 +251,7 @@
> if (responseId == GTK_RESPONSE_OK) {
> fileName = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (GTK_WIDGET (ptr)));
> str_fileName = (*gdk_env)->NewStringUTF (gdk_env, fileName);
> - } else if (responseId == GTK_RESPONSE_CANCEL) {
> + } else /* responseId == GTK_RESPONSE_CANCEL */ {
> str_fileName = NULL;
> }
>
I think str_fileName should be initialized to NULL when it is declared
and the else clause should be removed.
With that change, this patch can go in.
Tom