diff options
Diffstat (limited to 'libgfortran/io/inquire.c')
-rw-r--r-- | libgfortran/io/inquire.c | 49 |
1 files changed, 16 insertions, 33 deletions
diff --git a/libgfortran/io/inquire.c b/libgfortran/io/inquire.c index 4b6a6f5c1d3..047be39ec7a 100644 --- a/libgfortran/io/inquire.c +++ b/libgfortran/io/inquire.c @@ -26,7 +26,6 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see /* Implement the non-IOLENGTH variant of the INQUIRY statement */ #include "io.h" -#include "async.h" #include "unix.h" #include <string.h> @@ -282,6 +281,12 @@ inquire_via_unit (st_parameter_inquire *iqp, gfc_unit *u) { GFC_INTEGER_4 cf2 = iqp->flags2; + if ((cf2 & IOPARM_INQUIRE_HAS_PENDING) != 0) + *iqp->pending = 0; + + if ((cf2 & IOPARM_INQUIRE_HAS_ID) != 0) + *iqp->id = 0; + if ((cf2 & IOPARM_INQUIRE_HAS_ENCODING) != 0) { if (u == NULL || u->flags.form != FORM_FORMATTED) @@ -327,41 +332,19 @@ inquire_via_unit (st_parameter_inquire *iqp, gfc_unit *u) if (u == NULL) p = undefined; else + switch (u->flags.async) { - switch (u->flags.async) - { - case ASYNC_YES: - p = yes; - break; - case ASYNC_NO: - p = no; - break; - default: - internal_error (&iqp->common, "inquire_via_unit(): Bad async"); - } + case ASYNC_YES: + p = yes; + break; + case ASYNC_NO: + p = no; + break; + default: + internal_error (&iqp->common, "inquire_via_unit(): Bad async"); } - cf_strcpy (iqp->asynchronous, iqp->asynchronous_len, p); - } - if ((cf2 & IOPARM_INQUIRE_HAS_PENDING) != 0) - { - if (u->au == NULL) - *(iqp->pending) = 0; - else - { - LOCK (&(u->au->lock)); - if ((cf2 & IOPARM_INQUIRE_HAS_ID) != 0) - { - int id; - id = *(iqp->id); - *(iqp->pending) = id > u->au->id.low; - } - else - { - *(iqp->pending) = ! u->au->empty; - } - UNLOCK (&(u->au->lock)); - } + cf_strcpy (iqp->asynchronous, iqp->asynchronous_len, p); } if ((cf2 & IOPARM_INQUIRE_HAS_SIGN) != 0) |