Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

merge #1

Open
wants to merge 832 commits into
base: master
Choose a base branch
from
Open

merge #1

wants to merge 832 commits into from

Conversation

agrandville
Copy link
Owner

No description provided.

dbaarda and others added 30 commits October 16, 2019 23:03
Make the description more generalized and less application specific.
The librsync code uses some C99 constructs, but old compilers such
as gcc 4.7 don't default to -std=c99. This commit makes sure librsync
is built with -std=c99.

Fixes:

src/rabinkarp.h:82:5: error: ‘for’ loop initial declarations are only allowed in C99 or C11 mode
     for (size_t i = len; i; i--) {
     ^
src/rabinkarp.h:82:5: note: use option -std=c99, -std=gnu99, -std=c11 or -std=gnu11 to compile your code

Signed-off-by: Pierre-Jean Texier <[email protected]>
CMakeLists: fix c99 build with old compilers.
It looks like some tabs crept in at some point.
C99 doesn't like anonymous unions or returning void function calls.
C99 doesn't like initializing char arrays from expressions. Brackets around a
string literal make it into an expression, so they had to go.
In CMakeLists.txt add "-pedantic" to CMAKE_C_FLAGS for gcc/clang to enable
stricter C99 compiling. Add checks for symbols __func__ and __FUNCTION__.

In src/config.h.cmake add cmakedefine's for HAVE___FUNC__ and
HAVE___FUNCTION__. Remove unimplemented FIXME defines for C99 standards const,
off_t, and size_t.

In src/trace.[ch] remove all support for compilers without C99's macro varargs
support. Add support for platforms with __FUNCTION__ instead of __func__. Use
C99 macro varargs instead of GNU named varargs and simplify macros.
In CMakeList.txt and src/config.h.cmake remove support for unused alloca
function, including HAVE_ALLOCA_H, HAVE_ALLOCA, CRAY_STACKSEG_END, C_ALLOCA,
and STACK_DIRECTION.

In src/config.h.cmake remove unused and unchecked or not working cmakedefines
for HAVE_LIBBZ2, HAVE_LIBPOPT, HAVE_LIBZ, HAVE_SNPRINTF, HAVE_VARARG_MACROS,
HAVE_VSNPRINTF, HAVE__SNPRINTF, and HAVE__VSNPRINTF. The HAVE_LIB* ones were
just broken and unused. The others were unchecked, unused, and for standard
C99 features we assume exist in the code.
In CMakeLists.txt and src/config.h.cmake remove HAVE_PROGRAM_INVOCATION_NAME.

In src/trace.c remove conditional use of program_invocation_short_name. This
was unused because we never checked/set HAVE_PROGRAM_INVOCATION_NAME.
We never used these HAVE_* defines and just assumed the features existed
anyway. Also put the checks and cmakedefines into the same order.
Clarify usage on rdiff(1) man page.
This makes the cmakedefines in src/config.h.cmake reflect the order of checks
in CMakeLists.txt. It also removes the obsolete STDC_HEADERS define.
For non-GNUC compatible compilers #define away __attribute__. For compilers
without __func__ or __FUNCTION__ use an empty string. Make logging use
RS_LOG_NONAME format when __func__ is an empty string. Use C99 fputs() instead
of Unix/Posix write(). Prune and tidy imports to only what's needed.
The docs for some of the stat() variants suggest sys/types.h is needed, so
best to import it incase it's actually needed on some platforms.
This removes all not-required #include statements, including some non-C99
headers, and re-arranges them into more consistent order.
…VE_UINT64.

We have not been setting HAVE_UINT64 which means we've not been using 64bit
support for calculating md4sums. Checking that the C99 stdint.h's UINT64_MAX
is defined is the best way of checking that the uint64_t type exists on the
target platform.
Add tests/netint_test.c and CMakeLists.txt changes to test rs_int_len().

In netint.[ch] replace runtime checks for invalid arguments with assert()
statements and tidy the argument names, variable names, and ordering. Replace
`unsigned char` arguments with `rs_byte_t`. Add an assert to rs_int_len() to
require the argument is positive.
Make code variables and structure more consistent. Add extra assert() check to
rs_tube_copy_from_scoop(). Replace fatal runtime check with assert() in
rs_tube_write().
Simplify and tidy netint.[ch], tube.c and add netint tests.
dbaarda and others added 17 commits September 12, 2021 20:55
Rename rs_scoop_total_avail() to rs_scoop_avail() and make it a static inline
in stream.h

Remove rs_job_input_is_ending() from job.[hc] and replace it with a
rs_scoop_eof() static inline in stream.h.

In scoop.c make rs_scoop_input() only shuffle data to the start of the buffer
if necessary to free up space. Also make an assert() check more strict about
the data being within the buffer. Slightly tidy up rs_scoop_read_rest().

In delta.c make rs_delta_s_slack() neater by using the new rs_scoop_*()
functions.
…oop.

Add static inline fuctions to stream.h for getting and iterating through
contiguous data buffers from the scoop.

In tube.c remove rs_tube_copy_from_scoop() and rs_tube_copy_from_stream() and
just make rs_tube_catchup_copy() iterate through contiguous buffers from the
scoop. In rs_tube_catchup() use rs_scoop_eof() to check for eof instead of
checking the scoop and stream directly.

Remove undefined/unused rs_buffers_copy() from steam.h.
This means we only accumulate data into the scoop buffer if the input stream
is too small, otherwise we process directly from the input stream.

In job.h rename scoop_pos to scan_pos and add scan_buf and scan_len for
pointing at the curren scan data, which can be either in the input stream or
the scoop buffer. Also give the scoop and scan fields proper doxygen comments.

In delta.c use scan_pos, scan_buf, and scan_len instead of scoop_pos,
scoop_next, and scoop_avail respectively. Change rs_getinput() to return an
rs_result_t and take the block_len as an argument, and have it set scan_buf
and scan_len using rs_scoop_readhead() to get at least enough data to scan and
emit a full miss literal command. Change rs_delta_s_scan() and
rs_delta_s_flush() to do rs_tube_catchup() before rs_getinput() to consume any
literal data off the scoop buffer before refilling it. Change the MAX_MISS_LEN
to 64K - 3 cmd bytes from 32K.

In whole.c change rs_delta_file() to use buffers large enough for 4x 64K
literal commands, which is large enough to scan without copying into the scoop
buffer.
This gives us a single point for defining the size used for delta commands and
streaming buffers.

In job.h define MAX_DELTA_CMD to be the maximum size of a single delta command
at 64K.

In delta.c use MAX_DELTA_CMD to define MAX_MISS_LEN and use it to get the
minimum readahead size in rs_getinput().

In whole.c use MAX_DELTA_CMD for defining the buffer sizes used for delta and
patch operations.
It turns out ssize_t is a Posix thing that doesn't exist on Windows. I
originally started using it in stream.h so that negative values could be used
to indicate errors when iterating through buffers. We don't use or need that,
so we can just use size_t instead.
In stream.h remove rs_scoop_input() and in scoop.c make it static inline.

This function nolonger needs to be called directly anywhere outside scoop.c.
…fers.

This points out that large buffers can be processed directly and can leave a
tail of data behind in the input buffer. Using large buffers avoids data
copies and can be much faster.
This means it matches the name of scoop.c which means tools like iwyu
correctly find and check it.
…our.

Update the docstring so it correctly describes how data is processed directly
from the input stream if there is sufficient data there.
Make delta directly process the input stream if it has enough data.
Add "Build install", "Upload build" and "Upload install" steps to test install and upload build and install artifacts.
added missing word
@agrandville agrandville closed this May 7, 2022
@agrandville agrandville reopened this May 7, 2022
* Update github actions checkout and upload-artifact to v3.

The old v2 versions of these github actions now produce errors warning you
need to update them.

* Fix lint.yml remove install of old libclang-common-9-dev package.

The iwyu package dependencies have been fixed, and this old package doesn't
exist any more.

* Run `make iwyu-fix` to fix includes for `tests/rabinkarp_perf.c`.

* Change the `iwyu` build target to use clang output format.

This format is much more compact and easier to read.

* Make `iwyu` build target trim noisy "note:" output and ignore fileutil.c.

* Update NEWS.md for all #243 changes.
* Add win32 install artifact to release instructions in `CONTRIBUTING.md`.

This ensures we have a compiled win64 release artifact with each release. Also
updated NEWS.md to include all pull requests since the last release.
Note CMakeLists.txt and TODO.md are already up to date.
Update everything necessary in preparation for release of v2.3.3.
* Fix #248 by putting `#include "config.h"` in all src/*.c files.

The iwyu tool doesn't handle `config.h` files well, and these includes were
incorrectly removed, which breaks things on some platforms. Add them back to
most `src/*.c` files with `/* IWYU pragma: keep */` to make iwyu ignore them.
We skip `src/hashtable.c` because it is a standalone tool that is platform
independent.

Also add `/* IWYU pragma: keep */` to includes in `src/fileutil.c` that are
needed on some platforms but not others. This means we can remove the special
exemptions to skip this file for the `iwyu` and `iwyu-fix` targets in
`CMakeLists.txt`.

Add some explicit typecasts to `rollsum.[ch]`  and `patch.c` to silence warnings on windows.

Update NEWS.md for `config.h` include fixes and added typecasts.
Update everything necessary in preparation for release of v2.3.2. Note
CMakeLists.txt and TODO.md are already up to date. Also correct
`CONTRIBUTING.md` release instructions for the right `html` path for doxygen
docs.
Prepare for development of the next v2.3.5 release.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants