On 10/14/07, William A. Rowe, Jr. <[EMAIL PROTECTED]> wrote:
> Lucian Adrian Grijincu wrote:
> > On 10/14/07, William A. Rowe, Jr. <[EMAIL PROTECTED]> wrote:
> >> Just forewarn - // isn't portable, please don't litter :) More than happy
> >> to see
> >> /* */ style comments.
> >
> > Sorry for being ignorant :). I'll try to remember that.
>
> I wouldn't have said anything if it wasn't the #2 most common mistake, right
> after
> using tabs instead of spaces :) I know - MS spoils us by calling their C++
> compiler
> a C compiler ;-)
>
Well, this file is VERY "tab" littered.
> > I think someone with Netware experience should review this code.
>
> Yes, if you weren't aware, patch is very tolerant of # comments, so you can
> attach
> your patch with something like...
I wasn't, thank you very much! (Truth be told, APR is the only open
source project I've contributed to and I know I still have much to
learn :)
OK, I've attached a patch, but I really feel awkward submitting a
patch for something:
a) I haven't compiled
b) I haven't tested
c) I have no experience working with it
d) I couldn't find any useful information about on Google/Koders
(apparently apr, apache MPM and a "gthr" project are the only known
open source projects that use some of these functions).
I hope this is the most blindfolded patch you'll ever see from me.
BTW, is there fear of goto amongst APR devs? I've gotten used to the
Linux kernel coding style and use it where I see fit. I've seen it is
used in some places inside APR, but if you don't like it I'll clean it
up and resubmit (I haven't found on
http://httpd.apache.org/dev/styleguide.html any goto related
reference).
--
Lucian
#This patch needs to be reviewed because none of the changes were tested
# and were made with no documentation about the Netware NX* API.
Index: threadproc/netware/thread.c
===================================================================
--- threadproc/netware/thread.c (revision 584624)
+++ threadproc/netware/thread.c (working copy)
@@ -124,20 +124,27 @@
/* long flags */ NX_CTX_NORMAL,
/* int *error */ &stat);
-
+ if ( (*new)->ctx == NULL )
+ goto free_pool;
+
stat = NXContextSetName(
/* NXContext_t ctx */ (*new)->ctx,
/* const char *name */ threadName);
+ if(stat)
+ goto free_context;
stat = NXThreadCreate(
/* NXContext_t context */ (*new)->ctx,
/* long flags */ flags,
/* NXThreadId_t *thread_id */ &(*new)->td);
+ if(stat==0)
+ return APR_SUCCESS;
- if(stat==0)
- return APR_SUCCESS;
-
- return(stat);// if error
+free_context:
+ NXContextFree((*new)->ctx);
+free_pool:
+ apr_pool_destroy((*new)->pool);
+ return(stat);
}
apr_os_thread_t apr_os_thread_current()
@@ -161,6 +168,7 @@
thd->exitval = retval;
apr_pool_destroy(thd->pool);
NXThreadExit(NULL);
+ NXContextFree(thd->ctx);
return APR_SUCCESS;
}