Re: Drawing the red line

Date view Thread view Subject view Author view

From: Godmar Back (gback@cs.utah.edu)
Date: Sun Nov 15 1998 - 21:20:40 EST


 two minor corrections:

>
> 2. If a function below the red line calls another function
> below the red line, it must
>
> a) pass on its errorInfo*,
> b) check for a failure return code and
> c) if the call failed, clean up its state and return to its
> caller.
>
> The errorInfo is only filled in right where the failure occurs.
> For example:
>

 Note that the following example is not an example for the preceding
sentence "The errorInfo is only filled in right where the failure occurs." ---
it's an example for a, b, c. The next example will show when an errorInfo
is filled in.
  
> bool
> processClass(Hjava_lang_Class* class, int tostate, errorInfo *einfo)
> {
> bool success = true; /* optimistic */
> ...
> lockStaticMutex(&classLock);
> ...
> /* Load and link the super class */
> if (class->superclass) {
> /* propagate failures in super class loading and
> * processing
> */
> class->superclass = getClass((uintp)class->superclass,
> class, einfo);
> if (class->superclass == 0) {
> success = false;
> goto done;
> }
> if (processClass(class->superclass, CSTATE_LINKED,
> einfo) == false) {
> success = false;
> goto done;
> }
> ...
> }
>
> done:
>
> unlockStaticMutex(&classLock);
> return (success);
> }
>
> In this example, processClass (below the red line) calls two other functions
> below the red line: processClass and getClass.
> Notice how it
> a) passes on its einfo
> b) checks for failure (getClass returning NULL, or processClass
> returning NULL)

This should read "processClass returning false".

        - Godmar


Date view Thread view Subject view Author view

This archive was generated by hypermail 2b29 : Sat Sep 23 2000 - 19:57:03 EDT