tdbc::odbc

Check-in [986133b362]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Fix inverted test in new loader.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 986133b36245dd0da21b159bc22171b2469579d7
User & Date: stu 2017-05-29 04:57:51.004
Context
2017-05-29
22:49
Finish INT2PTR/PTR2INT work for tdbc-odbc:remove a cast, clean out a commented cast. check-in: e0f3c0cef0 user: stu tags: trunk
04:57
Fix inverted test in new loader. check-in: 986133b362 user: stu tags: trunk
2017-05-27
11:59
Improvements to new lib loader. Now also can handle a list of libs taken ie. from an env var. check-in: 492ee97daf user: stu tags: trunk
Changes
Unified Diff Ignore Whitespace Patch
Changes to generic/odbcStubInit.c.
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235

	/*
	 * Left-to-right, trying to load a lib at each iteration.
         */
	for (i = 0; i < nels; i++) {
	    if (Tcl_LoadFile(interp, els[i], soSymbolNames, 0, (void *) soStubDefs, &handle) == TCL_OK) {
		/* Lib found and loaded. Cleanup and setup result. */
		Tcl_DecrRefCount(result); /* Throw away any accumulated errors. */
		result = Tcl_DuplicateObj(els[i]);
		Tcl_IncrRefCount(result);
		break;
	    }
	    Tcl_ListObjAppendElement(NULL, result, Tcl_GetObjResult(interp)); /* Collect error. */
	    handle = NULL; /* Important! This is eventually returned. */
	}







|







221
222
223
224
225
226
227
228
229
230
231
232
233
234
235

	/*
	 * Left-to-right, trying to load a lib at each iteration.
         */
	for (i = 0; i < nels; i++) {
	    if (Tcl_LoadFile(interp, els[i], soSymbolNames, 0, (void *) soStubDefs, &handle) == TCL_OK) {
		/* Lib found and loaded. Cleanup and setup result. */
		Tcl_DecrRefCount(result); /* Throw away any errors collected. */
		result = Tcl_DuplicateObj(els[i]);
		Tcl_IncrRefCount(result);
		break;
	    }
	    Tcl_ListObjAppendElement(NULL, result, Tcl_GetObjResult(interp)); /* Collect error. */
	    handle = NULL; /* Important! This is eventually returned. */
	}
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
    /*
     * Use default format(s) if not supplied.
     */
    if (soFormats == NULL) {
	soFormats = tdbcLibFormats;
    }

    if (result != NULL) {
	result = Tcl_NewListObj(0, NULL);
	Tcl_IncrRefCount(result);
    }

    /*
     * Try every possible combination (aka Kwazy Lookup).
     */
    for (nam =   &soNames[0]; *nam != NULL; nam++) {
    for (num = &soNumbers[0]; *num != NULL; num++) {
    for (fmt = &soFormats[0]; *fmt != NULL; fmt++) {
	lib = Tcl_ObjPrintf(*fmt, *nam, (*num[0] == '\0' ? "" : TDBC_SHLIB_SEP), *num);
	Tcl_IncrRefCount(lib);
	if (Tcl_LoadFile(interp, lib, soSymbolNames, 0, (void *) soStubDefs, &handle) == TCL_OK) {
	    /* Lib found and loaded. Cleanup and setup result. */
	    Tcl_DecrRefCount(result); /* Throw away any accumulated errors. */
	    result = lib;
	    goto loadDone;
	}
	Tcl_ListObjAppendElement(NULL, result, Tcl_GetObjResult(interp)); /* Collect error. */
	Tcl_DecrRefCount(lib);
	handle = NULL; /* Important! This is eventually returned. */
    }}}







|














|







253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
    /*
     * Use default format(s) if not supplied.
     */
    if (soFormats == NULL) {
	soFormats = tdbcLibFormats;
    }

    if (result == NULL) {
	result = Tcl_NewListObj(0, NULL);
	Tcl_IncrRefCount(result);
    }

    /*
     * Try every possible combination (aka Kwazy Lookup).
     */
    for (nam =   &soNames[0]; *nam != NULL; nam++) {
    for (num = &soNumbers[0]; *num != NULL; num++) {
    for (fmt = &soFormats[0]; *fmt != NULL; fmt++) {
	lib = Tcl_ObjPrintf(*fmt, *nam, (*num[0] == '\0' ? "" : TDBC_SHLIB_SEP), *num);
	Tcl_IncrRefCount(lib);
	if (Tcl_LoadFile(interp, lib, soSymbolNames, 0, (void *) soStubDefs, &handle) == TCL_OK) {
	    /* Lib found and loaded. Cleanup and setup result. */
	    Tcl_DecrRefCount(result); /* Throw away any errors collected. */
	    result = lib;
	    goto loadDone;
	}
	Tcl_ListObjAppendElement(NULL, result, Tcl_GetObjResult(interp)); /* Collect error. */
	Tcl_DecrRefCount(lib);
	handle = NULL; /* Important! This is eventually returned. */
    }}}