コード例 #1
0
ファイル: linkedlist.c プロジェクト: khsiue/datastructures
int testbench() {
	List *testList = (List*)malloc(sizeof(List));
	list_init(testList);
    int x = 8;
    list_insert(testList, NULL, x);	
    list_insert(testList, NULL, 3);	
   	printf("size %d\n", list_size(testList));
    print_list_int(testList);
    printf("remove 3\n");
    list_remove(testList, 3);
    print_list_int(testList);

    printf("remove 8\n");
    list_remove(testList, 8);
    print_list_int(testList);

    printf("remove 2\n");
    list_remove(testList, 2);
    print_list_int(testList);



    printf("%d\n", list_search(testList, 4));
    printf("%d\n", list_search(testList, 3));
    printf("%d\n", list_search(testList, 2));
	return 0;
};
コード例 #2
0
ファイル: gnc-hbci-utils.c プロジェクト: nizarklai/gnucash-1
/** Return the HBCI return code of the given 'job', or zero if none was
 * found. If 'verbose' is TRUE, make a lot of debugging messages about
 * this outboxjob. */
static int
gnc_hbci_debug_outboxjob (GNCInteractor *inter, AB_JOB *job, gboolean verbose)
{
    int cause = 0;
    AB_JOB_STATUS jobstatus;

    g_assert (job);

    if (verbose)
    {
        g_warning("gnc_hbci_debug_outboxjob: Job status: %s", AB_Job_Status2Char(AB_Job_GetStatus(job)));

        g_warning(", result: %s", AB_Job_GetResultText(job) ? AB_Job_GetResultText(job) : "(none)");
        g_warning("\n");
    }

    jobstatus = AB_Job_GetStatus (job);
    if (jobstatus == AB_Job_StatusError)
    {
        if (AB_Job_GetResultText (job))
        {
            /* Add the "result text" to the log window */
            char *logstring = g_strdup_printf("Job %s had an error: %s\n",
                                              AB_Job_Type2Char(AB_Job_GetType(job)),
                                              AB_Job_GetResultText(job));
            GNCInteractor_add_log_text (inter, logstring);
            g_free (logstring);
        }

        if (!verbose)
            g_warning("gnc_hbci_debug_outboxjob: Job %s had an error: %s\n",
                      AB_Job_Type2Char(AB_Job_GetType(job)),
                      AB_Job_GetResultText(job) ? AB_Job_GetResultText(job) : "(none)");
        cause = 9000;
    }
    else
    {
        cause = 0;
    }

#if 0
    /* hbci debugging code; might be adapted to aqbanking at a later
       point in time */
    list = AB_JOB_resultCodes (job);
    if (list_int_size (list) > 0)
    {

        cause = get_resultcode_error (list);

        if (verbose)
        {
            g_warning("OutboxJob resultcodes: ");
            print_list_int (list);

            switch (cause)
            {
            case 9310:
                msg = "Schluessel noch nicht hinterlegt";
                break;
            case 9320:
                msg = "Schluessel noch nicht freigeschaltet";
                break;
            case 9330:
                msg = "Schluessel gesperrt";
                break;
            case 9340:
                msg = "Schluessel falsch";
                break;
            default:
                msg = "Unknown";
            }
            g_warning("Probable cause of error was: code %d, msg: %s\n", cause, msg);
        }
    }
    else
    {
        if (verbose)
            g_warning("OutboxJob's resultCodes list has zero length.\n");
    }
    list_int_delete (list);
#endif

    return cause;
}