comparison sidinfo.c @ 127:1786b9d77782

Rename a variable, cosmetics.
author Matti Hamalainen <ccr@tnsp.org>
date Thu, 27 Oct 2016 11:52:58 +0300
parents c1462b7880e8
children abed2715ea68
comparison
equal deleted inserted replaced
126:c1462b7880e8 127:1786b9d77782
606 606
607 if (optFieldOutput && !optFormat.nitems) 607 if (optFieldOutput && !optFormat.nitems)
608 { 608 {
609 PSFStackItem item; 609 PSFStackItem item;
610 int i; 610 int i;
611
611 memset(&item, 0, sizeof(item)); 612 memset(&item, 0, sizeof(item));
612 siClearStack(&optFormat); 613 siClearStack(&optFormat);
614
613 for (i = 0; i < noptPSOptions; i++) 615 for (i = 0; i < noptPSOptions; i++)
614 { 616 {
615 item.cmd = i; 617 item.cmd = i;
616 siStackAddItem(&optFormat, &item); 618 siStackAddItem(&optFormat, &item);
617 } 619 }
626 628
627 if (setSLDBPath != NULL) 629 if (setSLDBPath != NULL)
628 { 630 {
629 // Initialize SLDB 631 // Initialize SLDB
630 int ret = THERR_OK; 632 int ret = THERR_OK;
631 th_ioctx *ctx = NULL; 633 th_ioctx *inFile = NULL;
632 if ((ctx = th_io_fopen(&th_stdio_io_ops, setSLDBPath, "r")) == NULL) 634 if ((inFile = th_io_fopen(&th_stdio_io_ops, setSLDBPath, "r")) == NULL)
633 { 635 {
634 THERR("Could not open SLDB '%s'.\n", 636 THERR("Could not open SLDB '%s'.\n",
635 setSLDBPath); 637 setSLDBPath);
636 goto err; 638 goto err;
637 } 639 }
641 { 643 {
642 THERR("Could not allocate SLDB structure!\n"); 644 THERR("Could not allocate SLDB structure!\n");
643 goto err; 645 goto err;
644 } 646 }
645 647
646 if ((ret = si_sldb_read(ctx, sidSLDB)) != THERR_OK) 648 if ((ret = si_sldb_read(inFile, sidSLDB)) != THERR_OK)
647 { 649 {
648 THERR("Error parsing SLDB: %d, %s\n", 650 THERR("Error parsing SLDB: %d, %s\n",
649 ret, th_error_str(ret)); 651 ret, th_error_str(ret));
650 goto err; 652 goto err;
651 } 653 }
652 th_io_close(ctx); 654 th_io_close(inFile);
653 655
654 if ((ret = si_sldb_build_index(sidSLDB)) != THERR_OK) 656 if ((ret = si_sldb_build_index(sidSLDB)) != THERR_OK)
655 { 657 {
656 THERR("Error building SLDB index: %d, %s.\n", 658 THERR("Error building SLDB index: %d, %s.\n",
657 ret, th_error_str(ret)); 659 ret, th_error_str(ret));
658 goto err; 660 goto err;
659 } 661 }
660 662
661 err: 663 err:
662 th_io_close(ctx); 664 th_io_close(inFile);
663 } 665 }
664 666
665 // Process files 667 // Process files
666 if (!th_args_process(argc, argv, optList, optListN, 668 if (!th_args_process(argc, argv, optList, optListN,
667 argHandleOpt, argHandleFile, OPTH_ONLY_OTHER)) 669 argHandleOpt, argHandleFile, OPTH_ONLY_OTHER))