Login
Check-in [f131b7b64a]
Login

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

Overview
Comment:Fix the amalgamation build, with thanks to BrickViking for reporting it.
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: f131b7b64aa3b9baba9838e36840bd4984e2d54c74f6f2594b1cd4e71bebcff7
User & Date: stephan 2025-07-27 10:13:23.828
Context
2025-07-27
10:33
Include a full copy of libfossil.h in libfossil.c instead of #include'ing it, like sqlite3.c does. check-in: 8ce9eb6650 user: stephan tags: trunk
10:13
Fix the amalgamation build, with thanks to BrickViking for reporting it. check-in: f131b7b64a user: stephan tags: trunk
10:01
Start adding FSL_API_ARMOR, adopted from SQLITE_API_ARMOR. When enabled, perform argument checks for illegal NULLs and known-out-of-range values which might otherwise lead to UB if left to pass through. That reflects the historical behavior, but i've since come to believe that such validation is not only largely unnecessary but also a low-hanging optimization point. With FSL_API_ARMOR disabled, illegal NULLs and range arguments lead to UB. This is currently only applied to a few functions - making it pervasive will be a long-term ongoing thing. check-in: 38a0d79bfa user: stephan tags: trunk
Changes
Unified Diff Ignore Whitespace Patch
Changes to auto.def.
164
165
166
167
168
169
170

171
172
173
174
175
176
177
#  if !defined($def)
#    define $def $valUnix
#  endif
#endif
}]
      }
    }

    close $out
    msg-result "Generated $ofile"
  }}
  return
}
# end of --amal bootstrap config generation
########################################################################







>







164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
#  if !defined($def)
#    define $def $valUnix
#  endif
#endif
}]
      }
    }
    puts $out "#endif /* $incGuard */"
    close $out
    msg-result "Generated $ofile"
  }}
  return
}
# end of --amal bootstrap config generation
########################################################################
Changes to src/xfer.c.
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
    fsl_xfcard_map(E)
#undef E
  };
  fsl_outputer * const fo = state;
  assert( fo );


#define f_out(msg) fo->out(fo->state, msg, sizeof(msg)-1)
#define f_outf(msg,...) fsl_appendf(fo->out, fo->state, msg, __VA_ARGS__)

  f_out("fsl_xfer metrics:\n");
  if( m->bytesWritten ){
    f_outf("Bytes written:   %," FSL_SIZE_T_PFMT "\n",
          m->bytesWritten);
  }
  f_outf("Cards read:      %," FSL_SIZE_T_PFMT "\n",
        m->rcvdCard);
  if( m->rcvdCard ){
    for( int i = fsl_xfcard_e__unknown + 1; i < fsl_xfcard_e_COUNT; ++i){
      if( m->cardsRx[i] ){
        f_outf("    %-12s %," FSL_SIZE_T_PFMT "\n",
              cardNames[i], m->cardsRx[i]);
      }
    }
  }
  if(m->bytesReadUncompressed){
    f_outf("Bytes read uncompressed: %," FSL_SIZE_T_PFMT "\n",
          m->bytesReadUncompressed);
  }
  if(m->bytesReadCompressed){
    f_outf("Bytes read compressed:   %," FSL_SIZE_T_PFMT "\n",
          m->bytesReadCompressed);
  }
  if( m->largestDecompressedResponse ){
    f_outf("Largest decompr. buffer: %," FSL_SIZE_T_PFMT "\n",
          m->largestDecompressedResponse);
  }
  if( m->largestCardPayload ){
    f_outf("Largest card payload:    %," FSL_SIZE_T_PFMT "\n",
          m->largestCardPayload);
  }

  fsl_timer tmt = {.user=0,.system=0,.wall=0};
  int nTimers = 0;
  char const * zTimerFmt =
    "    %-18s %-10.3lf %-10.3lf %-10.3lf %-10.3lf\n"







|
|

|

|


|




|





|



|



|



|







1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
    fsl_xfcard_map(E)
#undef E
  };
  fsl_outputer * const fo = state;
  assert( fo );


#define out(msg) fo->out(fo->state, msg, sizeof(msg)-1)
#define outf(msg,...) fsl_appendf(fo->out, fo->state, msg, __VA_ARGS__)

  out("fsl_xfer metrics:\n");
  if( m->bytesWritten ){
    outf("Bytes written:   %," FSL_SIZE_T_PFMT "\n",
          m->bytesWritten);
  }
  outf("Cards read:      %," FSL_SIZE_T_PFMT "\n",
        m->rcvdCard);
  if( m->rcvdCard ){
    for( int i = fsl_xfcard_e__unknown + 1; i < fsl_xfcard_e_COUNT; ++i){
      if( m->cardsRx[i] ){
        outf("    %-12s %," FSL_SIZE_T_PFMT "\n",
              cardNames[i], m->cardsRx[i]);
      }
    }
  }
  if(m->bytesReadUncompressed){
    outf("Bytes read uncompressed: %," FSL_SIZE_T_PFMT "\n",
          m->bytesReadUncompressed);
  }
  if(m->bytesReadCompressed){
    outf("Bytes read compressed:   %," FSL_SIZE_T_PFMT "\n",
          m->bytesReadCompressed);
  }
  if( m->largestDecompressedResponse ){
    outf("Largest decompr. buffer: %," FSL_SIZE_T_PFMT "\n",
          m->largestDecompressedResponse);
  }
  if( m->largestCardPayload ){
    outf("Largest card payload:    %," FSL_SIZE_T_PFMT "\n",
          m->largestCardPayload);
  }

  fsl_timer tmt = {.user=0,.system=0,.wall=0};
  int nTimers = 0;
  char const * zTimerFmt =
    "    %-18s %-10.3lf %-10.3lf %-10.3lf %-10.3lf\n"
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
        tm = &m->timer.process;
        zPre = "processing";
        break;
    }
    assert( tm );
    if( tm->user || tm->system || tm->wall ){
      if( 1==++nTimers ){
        f_out("\nfsl_xfer timers:\n");
        f_outf("    %-18s %-10s %-10s %-10s %-10s\n",
               "Purpose", "Wall (ms)", "CPU", "User", "System");
      }
      tmt.user += tm->user;
      tmt.system += tm->system;
      tmt.wall += tm->wall;
      f_outf( zTimerFmt, zPre,
             (double)(tm->wall / 1000.0),
             (double)((tm->user + tm->system) / 1000.0),
             (double)(tm->user / 1000.0),
             (double)(tm->system / 1000.0) );
    }
  }
  if( nTimers>1 ){
    f_outf( "    %.80c\n", '-');
    f_outf( zTimerFmt, "                 =",
            (double)(tmt.wall / 1000.0),
            (double)((tmt.user + tmt.system) / 1000.0),
            (double)(tmt.user / 1000.0),
            (double)(tmt.system / 1000.0) );
  }

#undef f_out
#undef f_outf
}

#undef MARKER
#undef fsl__sc_popen_init
#undef fsl__xfer__rch_decl







|
|





|







|
|






|
|





1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
        tm = &m->timer.process;
        zPre = "processing";
        break;
    }
    assert( tm );
    if( tm->user || tm->system || tm->wall ){
      if( 1==++nTimers ){
        out("\nfsl_xfer timers:\n");
        outf("    %-18s %-10s %-10s %-10s %-10s\n",
               "Purpose", "Wall (ms)", "CPU", "User", "System");
      }
      tmt.user += tm->user;
      tmt.system += tm->system;
      tmt.wall += tm->wall;
      outf( zTimerFmt, zPre,
             (double)(tm->wall / 1000.0),
             (double)((tm->user + tm->system) / 1000.0),
             (double)(tm->user / 1000.0),
             (double)(tm->system / 1000.0) );
    }
  }
  if( nTimers>1 ){
    outf( "    %.80c\n", '-');
    outf( zTimerFmt, "                 =",
            (double)(tmt.wall / 1000.0),
            (double)((tmt.user + tmt.system) / 1000.0),
            (double)(tmt.user / 1000.0),
            (double)(tmt.system / 1000.0) );
  }

#undef out
#undef outf
}

#undef MARKER
#undef fsl__sc_popen_init
#undef fsl__xfer__rch_decl
Changes to tools/make-amalgamation.bash.
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
  ${dSrcF}/repo.c
  ${dSrcF}/sc.c
  ${dSrcF}/schema.c
  ${dSrcF}/search.c
  ${dSrcF}/sha1.c
  ${dSrcF}/sha3.c
  ${dSrcF}/strftime.c
  ${dSrcF}/sync.c
  ${dSrcF}/tag.c
  ${dSrcF}/ticket.c
  ${dSrcF}/udf.c
  ${dSrcF}/utf8.c
  ${dSrcF}/vfile.c
  ${dSrcF}/vpath.c
  ${dSrcF}/wiki.c
  ${dSrcF}/zip.c
  ${dSrcF}/xfer.c
  ${dSrcF}/difftk_cstr.c
  ${dSrcF}/schema_config_cstr.c
  ${dSrcF}/schema_repo1_cstr.c
  ${dSrcF}/schema_repo2_cstr.c
  ${dSrcF}/schema_ckout_cstr.c
  ${dSrcF}/schema_ticket_cstr.c
  ${dSrcF}/schema_ticket_reports_cstr.c







<







|
|







142
143
144
145
146
147
148

149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
  ${dSrcF}/repo.c
  ${dSrcF}/sc.c
  ${dSrcF}/schema.c
  ${dSrcF}/search.c
  ${dSrcF}/sha1.c
  ${dSrcF}/sha3.c
  ${dSrcF}/strftime.c

  ${dSrcF}/tag.c
  ${dSrcF}/ticket.c
  ${dSrcF}/udf.c
  ${dSrcF}/utf8.c
  ${dSrcF}/vfile.c
  ${dSrcF}/vpath.c
  ${dSrcF}/wiki.c
  ${dSrcF}/xfer.c
  ${dSrcF}/zip.c
  ${dSrcF}/difftk_cstr.c
  ${dSrcF}/schema_config_cstr.c
  ${dSrcF}/schema_repo1_cstr.c
  ${dSrcF}/schema_repo2_cstr.c
  ${dSrcF}/schema_ckout_cstr.c
  ${dSrcF}/schema_ticket_cstr.c
  ${dSrcF}/schema_ticket_reports_cstr.c