Bug Summary

File:d/url2file.c
Warning:line 538, column 13
This statement is never executed

Annotated Source Code

Press '?' to see keyboard shortcuts

clang -cc1 -cc1 -triple x86_64-unknown-linux-gnu -analyze -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name url2file.c -analyzer-store=region -analyzer-opt-analyze-nested-blocks -analyzer-checker=core -analyzer-checker=apiModeling -analyzer-checker=unix -analyzer-checker=deadcode -analyzer-checker=security.insecureAPI.UncheckedReturn -analyzer-checker=security.insecureAPI.getpw -analyzer-checker=security.insecureAPI.gets -analyzer-checker=security.insecureAPI.mktemp -analyzer-checker=security.insecureAPI.mkstemp -analyzer-checker=security.insecureAPI.vfork -analyzer-checker=nullability.NullPassedToNonnull -analyzer-checker=nullability.NullReturnedFromNonnull -analyzer-output plist -w -setup-static-analyzer -mrelocation-model pic -pic-level 2 -fhalf-no-semantic-interposition -mframe-pointer=none -fmath-errno -ffp-contract=on -fno-rounding-math -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic -debugger-tuning=gdb -fcoverage-compilation-dir=/home/isvv/naviserver/nsd -resource-dir /usr/local/lib/clang/15.0.0 -D _FORTIFY_SOURCE=2 -D NDEBUG -D SYSTEM_MALLOC -I ../include -I /usr/include/tcl8.6 -D HAVE_CONFIG_H -internal-isystem /usr/local/lib/clang/15.0.0/include -internal-isystem /usr/local/include -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/11/../../../../x86_64-linux-gnu/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -O2 -std=c99 -fdebug-compilation-dir=/home/isvv/naviserver/nsd -ferror-limit 19 -stack-protector 2 -fgnuc-version=4.2.1 -vectorize-loops -vectorize-slp -analyzer-checker alpha -analyzer-output=html -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /tmp/scan-build-2022-07-23-130959-11103-1 -x c url2file.c
1/*
2 * The contents of this file are subject to the Mozilla Public License
3 * Version 1.1 (the "License"); you may not use this file except in
4 * compliance with the License. You may obtain a copy of the License at
5 * http://mozilla.org/.
6 *
7 * Software distributed under the License is distributed on an "AS IS"
8 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
9 * the License for the specific language governing rights and limitations
10 * under the License.
11 *
12 * The Original Code is AOLserver Code and related documentation
13 * distributed by AOL.
14 *
15 * The Initial Developer of the Original Code is America Online,
16 * Inc. Portions created by AOL are Copyright (C) 1999 America Online,
17 * Inc. All Rights Reserved.
18 *
19 * Alternatively, the contents of this file may be used under the terms
20 * of the GNU General Public License (the "GPL"), in which case the
21 * provisions of GPL are applicable instead of those above. If you wish
22 * to allow use of your version of this file only under the terms of the
23 * GPL and not to allow others to use your version of this file under the
24 * License, indicate your decision by deleting the provisions above and
25 * replace them with the notice and other provisions required by the GPL.
26 * If you do not delete the provisions above, a recipient may use your
27 * version of this file under either the License or the GPL.
28 */
29
30/*
31 * url2file.c --
32 *
33 * Routines to register, unregister, and run url2file callbacks.
34 */
35
36#include "nsd.h"
37
38/*
39 * The following structure defines a url2file callback including user
40 * routine and client data.
41 */
42
43typedef struct {
44 int refcnt;
45 Ns_Url2FileProc *proc;
46 Ns_Callback *deleteCallback;
47 void *arg;
48 unsigned int flags;
49} Url2File;
50
51/*
52 * The following structure defines a mount point for a URL path.
53 */
54
55typedef struct {
56 char *basepath;
57 char *url;
58 const char *server;
59} Mount;
60
61
62/*
63 * Static functions defined in this file.
64 */
65
66static Ns_Callback FreeMount;
67static void FreeUrl2File(void *arg);
68static Ns_ArgProc WalkCallback;
69static Ns_ServerInitProc ConfigServerUrl2File;
70
71
72/*
73 * Static variables defined in this file.
74 */
75
76static Ns_Mutex ulock;
77static int uid;
78
79
80/*
81 *----------------------------------------------------------------------
82 *
83 * NsInitUrl2File --
84 *
85 * Initialize the url2file API.
86 *
87 * Results:
88 * None.
89 *
90 * Side effects:
91 * None.
92 *
93 *----------------------------------------------------------------------
94 */
95
96void
97NsInitUrl2File(void)
98{
99 uid = Ns_UrlSpecificAlloc();
100 Ns_MutexInit(&ulock);
101 Ns_MutexSetName(&ulock, "nsd:url2file");
102
103 NsRegisterServerInit(ConfigServerUrl2File);
104}
105
106static Ns_ReturnCode
107ConfigServerUrl2File(const char *server)
108{
109 NsServer *servPtr;
110 Ns_ReturnCode result;
111
112 servPtr = NsGetServer(server);
113 if (likely(servPtr != NULL)(__builtin_expect((servPtr != ((void*)0)), 1))) {
114 Ns_RegisterUrl2FileProc(server, "/", Ns_FastUrl2FileProc, NULL((void*)0), servPtr, 0u);
115 Ns_SetUrlToFileProc(server, NsUrlToFileProc);
116 result = NS_OK;
117 } else {
118 result = NS_ERROR;
119 }
120
121 return result;
122}
123
124
125/*
126 *----------------------------------------------------------------------
127 *
128 * Ns_RegisterUrl2FileProc --
129 *
130 * Register a new procedure that acts like Ns_UrlToFile to service
131 * matching url pattern.
132 *
133 * Results:
134 * None.
135 *
136 * Side effects:
137 * The delete procedure of previously registered request, if any,
138 * will be called unless NS_OP_NODELETE flag is set.
139 * Overrides any procedure registered with Ns_SetUrlToFileProc().
140 *
141 *----------------------------------------------------------------------
142 */
143
144void
145Ns_RegisterUrl2FileProc(const char *server, const char *url,
146 Ns_Url2FileProc *proc, Ns_Callback *deleteCallback, void *arg,
147 unsigned int flags)
148{
149 NsServer *servPtr = NsGetServer(server);
150
151 if (servPtr != NULL((void*)0)) {
152 Url2File *u2fPtr;
153
154 servPtr->fastpath.url2file = NULL((void*)0);
155 u2fPtr = ns_malloc(sizeof(Url2File));
156 u2fPtr->proc = proc;
157 u2fPtr->deleteCallback = deleteCallback;
158 u2fPtr->arg = arg;
159 u2fPtr->flags = flags;
160 u2fPtr->refcnt = 1;
161 Ns_MutexLock(&ulock);
162 Ns_UrlSpecificSet(server, "x", url, uid, u2fPtr, flags, FreeUrl2File);
163 Ns_MutexUnlock(&ulock);
164 }
165}
166
167
168/*
169 *----------------------------------------------------------------------
170 *
171 * Ns_UnRegisterUrl2FileProc --
172 *
173 * Remove the procedure which matches the given url pattern.
174 *
175 * Results:
176 * None.
177 *
178 * Side effects:
179 * Registered peocedure's deleteProc may run.
180 *
181 *----------------------------------------------------------------------
182 */
183
184void
185Ns_UnRegisterUrl2FileProc(const char *server, const char *url, unsigned int flags)
186{
187 Ns_MutexLock(&ulock);
188 (void) Ns_UrlSpecificDestroy(server, "x", url, uid, flags);
189 Ns_MutexUnlock(&ulock);
190}
191
192
193/*
194 *----------------------------------------------------------------------
195 * Ns_FastUrl2FileProc --
196 *
197 * Construct a pathname relative to the server pages directory.
198 *
199 * Results:
200 * NS_OK or NS_ERROR if the NsPageRoot() proc fails.
201 *
202 * Side effects:
203 * None.
204 *
205 *----------------------------------------------------------------------
206 */
207
208Ns_ReturnCode
209Ns_FastUrl2FileProc(Ns_DStringTcl_DString *dsPtr, const char *url, const void *arg)
210{
211 Ns_ReturnCode status = NS_OK;
212 const NsServer *servPtr = arg;
213
214 if (NsPageRoot(dsPtr, servPtr, NULL((void*)0)) == NULL((void*)0)) {
215 status = NS_ERROR;
216 } else {
217 (void) Ns_MakePath(dsPtr, url, (char *)0L);
218 }
219
220 return status;
221}
222
223
224/*
225 *----------------------------------------------------------------------
226 *
227 * Ns_UrlToFile, NsUrlToFile --
228 *
229 * Construct the filename that corresponds to a URL.
230 *
231 * Results:
232 * Return NS_OK on success or NS_ERROR on failure.
233 *
234 * Side effects:
235 * None.
236 *
237 *----------------------------------------------------------------------
238 */
239
240Ns_ReturnCode
241Ns_UrlToFile(Ns_DStringTcl_DString *dsPtr, const char *server, const char *url)
242{
243 NsServer *servPtr;
244 Ns_ReturnCode status;
245
246 NS_NONNULL_ASSERT(dsPtr != NULL)((void) (0));
247 NS_NONNULL_ASSERT(server != NULL)((void) (0));
248 NS_NONNULL_ASSERT(url != NULL)((void) (0));
249
250 servPtr = NsGetServer(server);
251 if (likely(servPtr != NULL)(__builtin_expect((servPtr != ((void*)0)), 1))) {
252 status = NsUrlToFile(dsPtr, servPtr, url);
253 } else {
254 status = NS_ERROR;
255 }
256
257 return status;
258}
259
260Ns_ReturnCode
261NsUrlToFile(Ns_DStringTcl_DString *dsPtr, NsServer *servPtr, const char *url)
262{
263 Ns_ReturnCode status;
264
265 NS_NONNULL_ASSERT(dsPtr != NULL)((void) (0));
266 NS_NONNULL_ASSERT(servPtr != NULL)((void) (0));
267 NS_NONNULL_ASSERT(url != NULL)((void) (0));
268
269 if (servPtr->fastpath.url2file != NULL((void*)0)) {
270 status = (*servPtr->fastpath.url2file)(dsPtr, servPtr->server, url);
271 } else {
272 Url2File *u2fPtr;
273
274 Ns_MutexLock(&ulock);
275 u2fPtr = NsUrlSpecificGet(servPtr, "x", url, uid, 0u, NS_URLSPACE_DEFAULT, NULL((void*)0), NULL((void*)0));
276 if (u2fPtr == NULL((void*)0)) {
277 Ns_Log(Error, "url2file: no proc found for url: %s", url);
278 status = NS_ERROR;
279 } else {
280 ++u2fPtr->refcnt;
281 Ns_MutexUnlock(&ulock);
282 status = (*u2fPtr->proc)(dsPtr, url, u2fPtr->arg);
283 Ns_MutexLock(&ulock);
284 FreeUrl2File(u2fPtr);
285 }
286 Ns_MutexUnlock(&ulock);
287 }
288 if (status == NS_OK) {
289 while (dsPtr->length > 0 && dsPtr->string[dsPtr->length -1] == '/') {
290 Ns_DStringSetLengthTcl_DStringSetLength(dsPtr, dsPtr->length -1);
291 }
292 }
293
294 return status;
295}
296
297
298/*
299 *----------------------------------------------------------------------
300 * Ns_SetUrlToFileProc --
301 *
302 * Set pointer to custom procedure that acts like Ns_UrlToFile().
303 *
304 * Deprecated, use Ns_RegisterUrl2FileProc().
305 *
306 * Results:
307 * None.
308 *
309 * Side effects:
310 * Overrides all existing procedures registered with new API.
311 *
312 *----------------------------------------------------------------------
313 */
314
315void
316Ns_SetUrlToFileProc(const char *server, Ns_UrlToFileProc *procPtr)
317{
318 NsServer *servPtr = NsGetServer(server);
319
320 if (servPtr != NULL((void*)0)) {
321 servPtr->fastpath.url2file = procPtr;
322 }
323}
324
325
326/*
327 *----------------------------------------------------------------------
328 *
329 * NsUrlToFileProc --
330 *
331 * Default old-style url2file proc registered at server startup.
332 *
333 * Results:
334 * NS_OK or NS_ERROR.
335 *
336 * Side effects:
337 * None.
338 *
339 *----------------------------------------------------------------------
340 */
341
342Ns_ReturnCode
343NsUrlToFileProc(Ns_DStringTcl_DString *dsPtr, const char *server, const char *url)
344{
345 const NsServer *servPtr = NsGetServer(server);
346 Ns_ReturnCode result;
347
348 if (likely(servPtr != NULL)(__builtin_expect((servPtr != ((void*)0)), 1))) {
349 result = Ns_FastUrl2FileProc(dsPtr, url, servPtr);
350 } else {
351 result = NS_ERROR;
352 }
353 return result;
354}
355
356
357/*
358 *----------------------------------------------------------------------
359 *
360 * NsTclUrl2FileObjCmd --
361 *
362 * Implements "ns_url2file".
363 *
364 * Results:
365 * Tcl result.
366 *
367 * Side effects:
368 * None.
369 *
370 *----------------------------------------------------------------------
371 */
372
373int
374NsTclUrl2FileObjCmd(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const* objv)
375{
376 int result = TCL_OK0;
377
378 if (objc != 2) {
379 Tcl_WrongNumArgs(interp, 1, objv, "url");
380 result = TCL_ERROR1;
381 } else {
382 Ns_DStringTcl_DString ds;
383 const NsInterp *itPtr = clientData;
384
385 Ns_DStringInitTcl_DStringInit(&ds);
386 if (NsUrlToFile(&ds, itPtr->servPtr, Tcl_GetString(objv[1])) != NS_OK) {
387 Ns_TclPrintfResult(interp, "url2file lookup failed for %s", Tcl_GetString(objv[1]));
388 Ns_DStringFreeTcl_DStringFree(&ds);
389 result = TCL_ERROR1;
390 } else {
391 Tcl_DStringResult(interp, &ds);
392 }
393 }
394 return result;
395}
396
397
398/*
399 *----------------------------------------------------------------------
400 *
401 * NsTclRegisterUrl2FileObjCmd --
402 *
403 * Implements "ns_register_url2file".
404 *
405 * Results:
406 * Tcl result.
407 *
408 * Side effects:
409 * See Ns_RegisterUrl2FileProc().
410 *
411 *----------------------------------------------------------------------
412 */
413
414int
415NsTclRegisterUrl2FileObjCmd(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const* objv)
416{
417 char *url;
418 Tcl_Obj *scriptObj;
419 int remain = 0, noinherit = 0, result = TCL_OK0;
420 Ns_ObjvSpec opts[] = {
421 {"-noinherit", Ns_ObjvBool, &noinherit, INT2PTR(NS_TRUE)((void *)(intptr_t)(1))},
422 {"--", Ns_ObjvBreak, NULL((void*)0), NULL((void*)0)},
423 {NULL((void*)0), NULL((void*)0), NULL((void*)0), NULL((void*)0)}
424 };
425 Ns_ObjvSpec args[] = {
426 {"url", Ns_ObjvString, &url, NULL((void*)0)},
427 {"script", Ns_ObjvObj, &scriptObj, NULL((void*)0)},
428 {"?args", Ns_ObjvArgs, &remain, NULL((void*)0)},
429 {NULL((void*)0), NULL((void*)0), NULL((void*)0), NULL((void*)0)}
430 };
431 if (Ns_ParseObjv(opts, args, interp, 1, objc, objv) != NS_OK) {
432 result = TCL_ERROR1;
433 } else {
434 const NsInterp *itPtr = clientData;
435 unsigned int flags;
436 Ns_TclCallback *cbPtr;
437
438 cbPtr = Ns_TclNewCallback(interp, (ns_funcptr_t)NsTclUrl2FileProc,
439 scriptObj, remain, objv + (objc - remain));
440 flags = (noinherit != 0) ? NS_OP_NOINHERIT0x02u : 0u;
441 Ns_RegisterUrl2FileProc(itPtr->servPtr->server, url,
442 NsTclUrl2FileProc, Ns_TclFreeCallback, cbPtr, flags);
443 }
444 return result;
445}
446
447
448/*
449 *----------------------------------------------------------------------
450 *
451 * NsTclUnRegisterUrl2FileObjCmd --
452 *
453 * Implements "ns_unregister_url2file".
454 *
455 * Results:
456 * Tcl result.
457 *
458 * Side effects:
459 * See Ns_UnRegisterUrlToFileProc().
460 *
461 *----------------------------------------------------------------------
462 */
463
464int
465NsTclUnRegisterUrl2FileObjCmd(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const* objv)
466{
467 char *url = NULL((void*)0);
468 int noinherit = 0, recurse = 0, result = TCL_OK0;
469 Ns_ObjvSpec opts[] = {
470 {"-noinherit", Ns_ObjvBool, &noinherit, INT2PTR(NS_TRUE)((void *)(intptr_t)(1))},
471 {"-recurse", Ns_ObjvBool, &recurse, INT2PTR(NS_TRUE)((void *)(intptr_t)(1))},
472 {"--", Ns_ObjvBreak, NULL((void*)0), NULL((void*)0)},
473 {NULL((void*)0), NULL((void*)0), NULL((void*)0), NULL((void*)0)}
474 };
475 Ns_ObjvSpec args[] = {
476 {"url", Ns_ObjvString, &url, NULL((void*)0)},
477 {NULL((void*)0), NULL((void*)0), NULL((void*)0), NULL((void*)0)}
478 };
479 if (Ns_ParseObjv(opts, args, interp, 1, objc, objv) != NS_OK) {
480 result = TCL_ERROR1;
481 } else {
482 unsigned int flags = 0u;
483 const NsInterp *itPtr = clientData;
484
485 if (noinherit != 0) {
486 flags |= NS_OP_NOINHERIT0x02u;
487 }
488 if (recurse != 0) {
489 flags |= NS_OP_RECURSE0x08u;
490 }
491
492 Ns_UnRegisterUrl2FileProc(itPtr->servPtr->server, url, flags);
493 }
494
495 return result;
496}
497
498
499/*
500 *----------------------------------------------------------------------
501 *
502 * NsTclRegisterFastUrl2FileObjCmd --
503 *
504 * Implements "ns_register_fasturl2file". Register the default fast
505 * url2file proc for the given URL.
506 *
507 * Results:
508 * Tcl result.
509 *
510 * Side effects:
511 * None.
512 *
513 *----------------------------------------------------------------------
514 */
515
516int
517NsTclRegisterFastUrl2FileObjCmd(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const* objv)
518{
519 char *url = NULL((void*)0), *basepath = NULL((void*)0);
520 int noinherit = 0, result = TCL_OK0;
521 Ns_ObjvSpec opts[] = {
522 {"-noinherit", Ns_ObjvBool, &noinherit, INT2PTR(NS_TRUE)((void *)(intptr_t)(1))},
523 {"--", Ns_ObjvBreak, NULL((void*)0), NULL((void*)0)},
524 {NULL((void*)0), NULL((void*)0), NULL((void*)0), NULL((void*)0)}
525 };
526 Ns_ObjvSpec args[] = {
527 {"url", Ns_ObjvString, &url, NULL((void*)0)},
528 {"?basepath", Ns_ObjvString, &basepath, NULL((void*)0)},
529 {NULL((void*)0), NULL((void*)0), NULL((void*)0), NULL((void*)0)}
530 };
531 if (Ns_ParseObjv(opts, args, interp, 1, objc, objv) != NS_OK) {
532 result = TCL_ERROR1;
533 } else {
534 const NsInterp *itPtr = clientData;
535 unsigned int flags = 0u;
536
537 if (noinherit != 0) {
538 flags |= NS_OP_NOINHERIT0x02u;
This statement is never executed
539 }
540
541 if (basepath == NULL((void*)0)) {
542 Ns_RegisterUrl2FileProc(itPtr->servPtr->server, url,
543 Ns_FastUrl2FileProc, NULL((void*)0), itPtr->servPtr,
544 flags);
545 } else {
546 Mount *mPtr;
547
548 mPtr = ns_malloc(sizeof(Mount));
549 mPtr->basepath = ns_strdup(basepath);
550 mPtr->url = ns_strdup(url);
551 mPtr->server = itPtr->servPtr->server;
552 Ns_RegisterUrl2FileProc(itPtr->servPtr->server, url,
553 NsMountUrl2FileProc, FreeMount, mPtr, flags);
554 }
555 }
556 return result;
557}
558
559
560/*
561 *----------------------------------------------------------------------
562 *
563 * NsTclUrl2FileProc --
564 *
565 * Callback for Tcl url2file procs.
566 *
567 * Results:
568 * NS_OK or NS_ERROR.
569 *
570 * Side effects:
571 * Depends on Tcl script.
572 *
573 *----------------------------------------------------------------------
574 */
575
576Ns_ReturnCode
577NsTclUrl2FileProc(Ns_DStringTcl_DString *dsPtr, const char *url, const void *arg)
578{
579 Ns_ReturnCode status = NS_OK;
580 const Ns_TclCallback *cbPtr = arg;
581
582 if (unlikely(Ns_TclEvalCallback(NULL, cbPtr, dsPtr, url, (char *)0L) != TCL_OK)(__builtin_expect((Ns_TclEvalCallback(((void*)0), cbPtr, dsPtr
, url, (char *)0L) != 0), 0))
) {
583 status = NS_ERROR;
584 }
585 return status;
586}
587
588
589/*
590 *----------------------------------------------------------------------
591 *
592 * NsMountUrl2FileProc --
593 *
594 * Construct new path relative to registered basepath.
595 *
596 * Results:
597 * NS_OK.
598 *
599 * Side effects:
600 * None.
601 *
602 *----------------------------------------------------------------------
603 */
604
605Ns_ReturnCode
606NsMountUrl2FileProc(Ns_DStringTcl_DString *dsPtr, const char *url, const void *arg)
607{
608 Ns_ReturnCode status = NS_OK;
609 const Mount *mPtr = arg;
610 const char *u;
611
612 u = mPtr->url;
613 while (*u != '\0' && *url != '\0' && *u == *url) {
614 ++u;
615 ++url;
616 }
617 if (Ns_PathIsAbsolute(mPtr->basepath)) {
618 Ns_MakePath(dsPtr, mPtr->basepath, url, (char *)0L);
619 } else if (Ns_PagePath(dsPtr, mPtr->server, mPtr->basepath, url, (char *)0L) == NULL((void*)0)) {
620 status = NS_ERROR;
621 }
622
623 return status;
624}
625
626
627/*
628 *----------------------------------------------------------------------
629 *
630 * NsMountUrl2FileArgProc --
631 *
632 * Info callback for procs which take Mount arg.
633 *
634 * Results:
635 * None.
636 *
637 * Side effects:
638 * None.
639 *
640 *----------------------------------------------------------------------
641 */
642
643void
644NsMountUrl2FileArgProc(Tcl_DString *dsPtr, const void *arg)
645{
646 const Mount *mPtr = arg;
647
648 Tcl_DStringAppendElement(dsPtr, mPtr->basepath);
649 Tcl_DStringAppendElement(dsPtr, mPtr->url);
650}
651
652
653/*
654 *----------------------------------------------------------------------
655 *
656 * NsGetUrl2FileProcs --
657 *
658 * Append information about registered url2file procs to dstring.
659 *
660 * Results:
661 * None.
662 *
663 * Side effects:
664 * None.
665 *
666 *----------------------------------------------------------------------
667 */
668
669void
670NsGetUrl2FileProcs(Ns_DStringTcl_DString *dsPtr, const char *server)
671{
672 NS_NONNULL_ASSERT(dsPtr != NULL)((void) (0));
673 NS_NONNULL_ASSERT(server != NULL)((void) (0));
674
675 Ns_MutexLock(&ulock);
676 Ns_UrlSpecificWalk(uid, server, WalkCallback, dsPtr);
677 Ns_MutexUnlock(&ulock);
678}
679
680static void
681WalkCallback(Ns_DStringTcl_DString *dsPtr, const void *arg)
682{
683 const Url2File *u2fPtr = arg;
684
685 Ns_GetProcInfo(dsPtr, (ns_funcptr_t)u2fPtr->proc, u2fPtr->arg);
686}
687
688
689/*
690 *----------------------------------------------------------------------
691 *
692 * FreeMount --
693 *
694 * Free Mount data.
695 *
696 * Results:
697 * None.
698 *
699 * Side effects:
700 * None.
701 *
702 *----------------------------------------------------------------------
703 */
704
705static void
706FreeMount(void *arg)
707{
708 Mount *mPtr = arg;
709
710 ns_free(mPtr->basepath);
711 ns_free(mPtr->url);
712 ns_free(mPtr);
713}
714
715
716/*
717 *----------------------------------------------------------------------
718 *
719 * FreeUrl2File --
720 *
721 * Free Url2File data when reference count reaches 0.
722 *
723 * Results:
724 * None.
725 *
726 * Side effects:
727 * Depends on request delete procedure.
728 *
729 *----------------------------------------------------------------------
730 */
731
732static void
733FreeUrl2File(void *arg)
734{
735 Url2File *u2fPtr = (Url2File *) arg;
736
737 if (--u2fPtr->refcnt == 0) {
738 if (u2fPtr->deleteCallback != NULL((void*)0)) {
739 (*u2fPtr->deleteCallback)(u2fPtr->arg);
740 }
741 ns_free(u2fPtr);
742 }
743}
744
745/*
746 * Local Variables:
747 * mode: c
748 * c-basic-offset: 4
749 * fill-column: 78
750 * indent-tabs-mode: nil
751 * End:
752 */