You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by st...@apache.org on 2011/01/01 21:02:37 UTC
svn commit: r1054277 - in /subversion/trunk/subversion:
include/private/svn_adler32.h libsvn_diff/diff.h libsvn_diff/diff_file.c
libsvn_diff/diff_memory.c libsvn_diff/util.c libsvn_subr/adler32.c
Author: stefan2
Date: Sat Jan 1 20:02:36 2011
New Revision: 1054277
URL: http://svn.apache.org/viewvc?rev=1054277&view=rev
Log:
Move & rename svn_diff__adler32 to svn__adler32 to make it available
to e.g. svnlib_delta where I will use it soon.
* subversion/libsvn_subr/adler32.c
(ADLER_MOD_BASE): moved from libsvn_diff/util.c
(svn__adler32): moved and renamed from libsvn_diff/util.c
* subversion/include/private/svn_adler32.h
(svn__adler32): moved declaration from libsvn_diff/diff.h
* subversion/libsvn_diff/util.c
(ADLER_MOD_BASE, svn_diff__adler32): moved
* subversion/libsvn_diff/diff.c
(svn_diff__adler32): moved
* subversion/libsvn_diff/diff_memory.c
(datasource_get_next_token): adapt to renamed adler32() function
* subversion/libsvn_diff/diff_file.c
(datasource_get_next_token): dito
Added:
subversion/trunk/subversion/include/private/svn_adler32.h (contents, props changed)
- copied, changed from r1054248, subversion/trunk/subversion/libsvn_diff/diff.h
subversion/trunk/subversion/libsvn_subr/adler32.c (contents, props changed)
- copied, changed from r1054251, subversion/trunk/subversion/libsvn_diff/util.c
Modified:
subversion/trunk/subversion/libsvn_diff/diff.h
subversion/trunk/subversion/libsvn_diff/diff_file.c
subversion/trunk/subversion/libsvn_diff/diff_memory.c
subversion/trunk/subversion/libsvn_diff/util.c
Copied: subversion/trunk/subversion/include/private/svn_adler32.h (from r1054248, subversion/trunk/subversion/libsvn_diff/diff.h)
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/private/svn_adler32.h?p2=subversion/trunk/subversion/include/private/svn_adler32.h&p1=subversion/trunk/subversion/libsvn_diff/diff.h&r1=1054248&r2=1054277&rev=1054277&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_diff/diff.h (original)
+++ subversion/trunk/subversion/include/private/svn_adler32.h Sat Jan 1 20:02:36 2011
@@ -1,6 +1,5 @@
-/*
- * diff.h : private header file
- *
+/**
+ * @copyright
* ====================================================================
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -19,140 +18,25 @@
* specific language governing permissions and limitations
* under the License.
* ====================================================================
+ * @endcopyright
+ *
+ * @file svn_adler32.h
+ * @brief Subversion's take on Adler-32 calculation
*/
-#if !defined(DIFF_H)
-#define DIFF_H
+#ifndef SVN_ADLER32_H
+#define SVN_ADLER32_H
#include <apr.h>
-#include <apr_pools.h>
-#include <apr_general.h>
-
-#include "svn_diff.h"
-#include "svn_types.h"
-
-#define SVN_DIFF__UNIFIED_CONTEXT_SIZE 3
-
-typedef struct svn_diff__node_t svn_diff__node_t;
-typedef struct svn_diff__tree_t svn_diff__tree_t;
-typedef struct svn_diff__position_t svn_diff__position_t;
-typedef struct svn_diff__lcs_t svn_diff__lcs_t;
-
-typedef enum svn_diff__type_e
-{
- svn_diff__type_common,
- svn_diff__type_diff_modified,
- svn_diff__type_diff_latest,
- svn_diff__type_diff_common,
- svn_diff__type_conflict
-} svn_diff__type_e;
-
-struct svn_diff_t {
- svn_diff_t *next;
- svn_diff__type_e type;
- apr_off_t original_start;
- apr_off_t original_length;
- apr_off_t modified_start;
- apr_off_t modified_length;
- apr_off_t latest_start;
- apr_off_t latest_length;
- svn_diff_t *resolved_diff;
-};
-
-struct svn_diff__position_t
-{
- svn_diff__position_t *next;
- svn_diff__node_t *node;
- apr_off_t offset;
-};
-
-struct svn_diff__lcs_t
-{
- svn_diff__lcs_t *next;
- svn_diff__position_t *position[2];
- apr_off_t length;
- int refcount;
-};
-
-
-/* State used when normalizing whitespace and EOL styles. */
-typedef enum svn_diff__normalize_state_t
-{
- /* Initial state; not in a sequence of whitespace. */
- svn_diff__normalize_state_normal,
- /* We're in a sequence of whitespace characters. Only entered if
- we ignore whitespace. */
- svn_diff__normalize_state_whitespace,
- /* The previous character was CR. */
- svn_diff__normalize_state_cr
-} svn_diff__normalize_state_t;
-
-
-svn_diff__lcs_t *
-svn_diff__lcs(svn_diff__position_t *position_list1, /* pointer to tail (ring) */
- svn_diff__position_t *position_list2, /* pointer to tail (ring) */
- apr_pool_t *pool);
-
-/*
- * Support functions to build a tree of token positions
- */
-void
-svn_diff__tree_create(svn_diff__tree_t **tree, apr_pool_t *pool);
-
-
-/*
- * Get all tokens from a datasource. Return the
- * last item in the (circular) list.
- */
-svn_error_t *
-svn_diff__get_tokens(svn_diff__position_t **position_list,
- svn_diff__tree_t *tree,
- void *diff_baton,
- const svn_diff_fns_t *vtable,
- svn_diff_datasource_e datasource,
- apr_pool_t *pool);
-
-
-/* Morph a svn_lcs_t into a svn_diff_t. */
-svn_diff_t *
-svn_diff__diff(svn_diff__lcs_t *lcs,
- apr_off_t original_start, apr_off_t modified_start,
- svn_boolean_t want_common,
- apr_pool_t *pool);
-
-void
-svn_diff__resolve_conflict(svn_diff_t *hunk,
- svn_diff__position_t **position_list1,
- svn_diff__position_t **position_list2,
- apr_pool_t *pool);
-
-
-/*
+/**
* Return an adler32 checksum based on CHECKSUM, updated with
* DATA of size LEN.
- */
-apr_uint32_t
-svn_diff__adler32(apr_uint32_t checksum, const char *data, apr_off_t len);
-
-
-/* Normalize the characters pointed to by the buffer BUF (of length *LENGTHP)
- * according to the options *OPTS, starting in the state *STATEP.
*
- * Adjust *LENGTHP and *STATEP to be the length of the normalized buffer and
- * the final state, respectively.
- * Normalized data is written to the memory at *TGT. BUF and TGT may point
- * to the same memory area. The memory area pointed to by *TGT should be
- * large enough to hold *LENGTHP bytes.
- * When on return *TGT is not equal to the value passed in, it points somewhere
- * into the memory region designated by BUF and *LENGTHP.
+ * @since New in 1.7.
*/
-void
-svn_diff__normalize_buffer(char **tgt,
- apr_off_t *lengthp,
- svn_diff__normalize_state_t *statep,
- const char *buf,
- const svn_diff_file_options_t *opts);
+apr_uint32_t
+svn__adler32(apr_uint32_t checksum, const char *data, apr_off_t len);
-#endif /* DIFF_H */
+#endif /* SVN_ADLER32_H */
Propchange: subversion/trunk/subversion/include/private/svn_adler32.h
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: subversion/trunk/subversion/include/private/svn_adler32.h
------------------------------------------------------------------------------
--- svn:mergeinfo (added)
+++ svn:mergeinfo Sat Jan 1 20:02:36 2011
@@ -0,0 +1,42 @@
+/subversion/branches/1.5.x-r30215/subversion/libsvn_diff/diff.h:870312
+/subversion/branches/atomic-revprop/subversion/libsvn_diff/diff.h:965046-1000689
+/subversion/branches/bdb-reverse-deltas/subversion/libsvn_diff/diff.h:872050-872529
+/subversion/branches/diff-callbacks3/subversion/libsvn_diff/diff.h:870059-870761
+/subversion/branches/dont-save-plaintext-passwords-by-default/subversion/libsvn_diff/diff.h:870728-871118
+/subversion/branches/double-delete/subversion/libsvn_diff/diff.h:870511-872970
+/subversion/branches/explore-wc/subversion/libsvn_diff/diff.h:875486,875493,875497,875507,875511,875514,875559,875580-875581,875584,875587,875611,875627,875647,875667-875668,875711-875712,875733-875734,875736,875744-875748,875751,875758,875782,875795-875796,875830,875836,875838,875842,875852,875855,875864,875870,875873,875880,875885-875888,875890,875897-875898,875905,875907-875909,875935,875943-875944,875946,875979,875982-875983,875985-875986,875990,875997
+/subversion/branches/file-externals/subversion/libsvn_diff/diff.h:871779-873302
+/subversion/branches/fs-rep-sharing/subversion/libsvn_diff/diff.h:869036-873803
+/subversion/branches/fsfs-pack/subversion/libsvn_diff/diff.h:873717-874575
+/subversion/branches/gnome-keyring/subversion/libsvn_diff/diff.h:870558-871410
+/subversion/branches/http-protocol-v2/subversion/libsvn_diff/diff.h:874395-876041
+/subversion/branches/in-memory-cache/subversion/libsvn_diff/diff.h:869829-871452
+/subversion/branches/issue-2779-dev/subversion/libsvn_diff/diff.h:965496-984198
+/subversion/branches/issue-2843-dev/subversion/libsvn_diff/diff.h:871432-874179
+/subversion/branches/issue-3000/subversion/libsvn_diff/diff.h:871713,871716-871719,871721-871726,871728,871734
+/subversion/branches/issue-3067-deleted-subtrees/subversion/libsvn_diff/diff.h:873375-874084
+/subversion/branches/issue-3148-dev/subversion/libsvn_diff/diff.h:875193-875204
+/subversion/branches/issue-3220-dev/subversion/libsvn_diff/diff.h:872210-872226
+/subversion/branches/issue-3242-dev/subversion/libsvn_diff/diff.h:879653-896436
+/subversion/branches/issue-3334-dirs/subversion/libsvn_diff/diff.h:875156-875867
+/subversion/branches/issue-3668-3669/subversion/libsvn_diff/diff.h:1031000-1035744
+/subversion/branches/kwallet/subversion/libsvn_diff/diff.h:870785-871314
+/subversion/branches/log-g-performance/subversion/libsvn_diff/diff.h:870941-871032
+/subversion/branches/merge-skips-obstructions/subversion/libsvn_diff/diff.h:874525-874615
+/subversion/branches/nfc-nfd-aware-client/subversion/libsvn_diff/diff.h:870276,870376
+/subversion/branches/performance/subversion/libsvn_diff/diff.h:982355,983764,983766,984927,984984,985014,985037,985046,985472,985477,985482,985500,985606,985669,986453,987888,987893,995507,995603,1001413,1025660,1028092,1028094,1028104,1029038,1029042,1029090,1029092,1029335,1030763
+/subversion/branches/py-tests-as-modules/subversion/libsvn_diff/diff.h:956579-1033052
+/subversion/branches/ra_serf-digest-authn/subversion/libsvn_diff/diff.h:875693-876404
+/subversion/branches/reintegrate-improvements/subversion/libsvn_diff/diff.h:873853-874164
+/subversion/branches/subtree-mergeinfo/subversion/libsvn_diff/diff.h:876734-878766
+/subversion/branches/svn-mergeinfo-enhancements/subversion/libsvn_diff/diff.h:870119-870195,870197-870288
+/subversion/branches/svn-patch-improvements/subversion/libsvn_diff/diff.h:918519-934609
+/subversion/branches/svnpatch-diff/subversion/libsvn_diff/diff.h:865738-876477
+/subversion/branches/svnraisetc/subversion/libsvn_diff/diff.h:874709-875149
+/subversion/branches/svnserve-logging/subversion/libsvn_diff/diff.h:869828-870893
+/subversion/branches/tc-issue-3334/subversion/libsvn_diff/diff.h:874697-874773
+/subversion/branches/tc-merge-notify/subversion/libsvn_diff/diff.h:874017-874062
+/subversion/branches/tc-resolve/subversion/libsvn_diff/diff.h:874191-874239
+/subversion/branches/tc_url_rev/subversion/libsvn_diff/diff.h:874351-874483
+/subversion/branches/tree-conflicts/subversion/libsvn_diff/diff.h:868291-873154
+/subversion/branches/tree-conflicts-notify/subversion/libsvn_diff/diff.h:873926-874008
Modified: subversion/trunk/subversion/libsvn_diff/diff.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_diff/diff.h?rev=1054277&r1=1054276&r2=1054277&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_diff/diff.h (original)
+++ subversion/trunk/subversion/libsvn_diff/diff.h Sat Jan 1 20:02:36 2011
@@ -128,14 +128,6 @@ svn_diff__resolve_conflict(svn_diff_t *h
apr_pool_t *pool);
-/*
- * Return an adler32 checksum based on CHECKSUM, updated with
- * DATA of size LEN.
- */
-apr_uint32_t
-svn_diff__adler32(apr_uint32_t checksum, const char *data, apr_off_t len);
-
-
/* Normalize the characters pointed to by the buffer BUF (of length *LENGTHP)
* according to the options *OPTS, starting in the state *STATEP.
*
Modified: subversion/trunk/subversion/libsvn_diff/diff_file.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_diff/diff_file.c?rev=1054277&r1=1054276&r2=1054277&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_diff/diff_file.c (original)
+++ subversion/trunk/subversion/libsvn_diff/diff_file.c Sat Jan 1 20:02:36 2011
@@ -46,6 +46,7 @@
#include "private/svn_utf_private.h"
#include "private/svn_eol_private.h"
+#include "private/svn_adler32.h"
/* A token, i.e. a line read from a file. */
typedef struct svn_diff__file_token_t
@@ -330,7 +331,7 @@ datasource_get_next_token(apr_uint32_t *
&file->normalize_state,
curp, file_baton->options);
file_token->length += length;
- h = svn_diff__adler32(h, curp, length);
+ h = svn__adler32(h, curp, length);
curp = endp = file->buffer;
file->chunk++;
@@ -377,7 +378,7 @@ datasource_get_next_token(apr_uint32_t *
file_token->length += length;
- *hash = svn_diff__adler32(h, c, length);
+ *hash = svn__adler32(h, c, length);
*token = file_token;
}
Modified: subversion/trunk/subversion/libsvn_diff/diff_memory.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_diff/diff_memory.c?rev=1054277&r1=1054276&r2=1054277&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_diff/diff_memory.c (original)
+++ subversion/trunk/subversion/libsvn_diff/diff_memory.c Sat Jan 1 20:02:36 2011
@@ -34,6 +34,7 @@
#include "svn_utf.h"
#include "diff.h"
#include "svn_private_config.h"
+#include "private/svn_adler32.h"
typedef struct source_tokens_t
{
@@ -128,7 +129,7 @@ datasource_get_next_token(apr_uint32_t *
svn_diff__normalize_buffer(&buf, &len, &state, tok->data,
mem_baton->normalization_options);
- *hash = svn_diff__adler32(0, buf, len);
+ *hash = svn__adler32(0, buf, len);
src->next_token++;
}
else
Modified: subversion/trunk/subversion/libsvn_diff/util.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_diff/util.c?rev=1054277&r1=1054276&r2=1054277&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_diff/util.c (original)
+++ subversion/trunk/subversion/libsvn_diff/util.c Sat Jan 1 20:02:36 2011
@@ -24,7 +24,6 @@
#include <apr.h>
#include <apr_general.h>
-#include <zlib.h>
#include "svn_error.h"
#include "svn_diff.h"
@@ -33,78 +32,6 @@
#include "diff.h"
-/**
- * An Adler-32 implementation per RFC1950.
- *
- * "The Adler-32 algorithm is much faster than the CRC32 algorithm yet
- * still provides an extremely low probability of undetected errors"
- */
-
-/*
- * 65521 is the largest prime less than 65536.
- * "That 65521 is prime is important to avoid a possible large class of
- * two-byte errors that leave the check unchanged."
- */
-#define ADLER_MOD_BASE 65521
-
-/*
- * Start with CHECKSUM and update the checksum by processing a chunk
- * of DATA sized LEN.
- */
-apr_uint32_t
-svn_diff__adler32(apr_uint32_t checksum, const char *data, apr_off_t len)
-{
- /* The actual limit can be set somewhat higher but should
- * not be lower because the SIMD code would not be used
- * in that case.
- *
- * However, it must be lower than 5552 to make sure our local
- * implementation does not suffer from overflows.
- */
- if (len >= 80)
- {
- /* Larger buffers can be effiently handled by Marc Adler's
- * optimized code. Also, new zlib versions will come with
- * SIMD code for x86 and x64.
- */
- return adler32(checksum, data, len);
- }
- else
- {
- const unsigned char *input = (const unsigned char *)data;
- apr_uint32_t s1 = checksum & 0xFFFF;
- apr_uint32_t s2 = checksum >> 16;
- apr_uint32_t b;
-
- /* Some loop unrolling
- * (approx. one clock tick per byte + 2 ticks loop overhead)
- */
- for (; len >= 8; len -= 8, input += 8)
- {
- s1 += input[0]; s2 += s1;
- s1 += input[1]; s2 += s1;
- s1 += input[2]; s2 += s1;
- s1 += input[3]; s2 += s1;
- s1 += input[4]; s2 += s1;
- s1 += input[5]; s2 += s1;
- s1 += input[6]; s2 += s1;
- s1 += input[7]; s2 += s1;
- }
-
- /* Adler-32 calculation as a simple two ticks per iteration loop.
- */
- while (len--)
- {
- b = *input++;
- s1 += b;
- s2 += s1;
- }
-
- return ((s2 % ADLER_MOD_BASE) << 16) | (s1 % ADLER_MOD_BASE);
- }
-}
-
-
svn_boolean_t
svn_diff_contains_conflicts(svn_diff_t *diff)
{
Copied: subversion/trunk/subversion/libsvn_subr/adler32.c (from r1054251, subversion/trunk/subversion/libsvn_diff/util.c)
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_subr/adler32.c?p2=subversion/trunk/subversion/libsvn_subr/adler32.c&p1=subversion/trunk/subversion/libsvn_diff/util.c&r1=1054251&r2=1054277&rev=1054277&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_diff/util.c (original)
+++ subversion/trunk/subversion/libsvn_subr/adler32.c Sat Jan 1 20:02:36 2011
@@ -1,5 +1,5 @@
/*
- * util.c : routines for doing diffs
+ * adler32.c : routines for doing diffs
*
* ====================================================================
* Licensed to the Apache Software Foundation (ASF) under one
@@ -23,15 +23,9 @@
#include <apr.h>
-#include <apr_general.h>
#include <zlib.h>
-#include "svn_error.h"
-#include "svn_diff.h"
-#include "svn_types.h"
-#include "svn_ctype.h"
-
-#include "diff.h"
+#include "private/svn_adler32.h"
/**
* An Adler-32 implementation per RFC1950.
@@ -52,7 +46,7 @@
* of DATA sized LEN.
*/
apr_uint32_t
-svn_diff__adler32(apr_uint32_t checksum, const char *data, apr_off_t len)
+svn__adler32(apr_uint32_t checksum, const char *data, apr_off_t len)
{
/* The actual limit can be set somewhat higher but should
* not be lower because the SIMD code would not be used
@@ -103,311 +97,3 @@ svn_diff__adler32(apr_uint32_t checksum,
return ((s2 % ADLER_MOD_BASE) << 16) | (s1 % ADLER_MOD_BASE);
}
}
-
-
-svn_boolean_t
-svn_diff_contains_conflicts(svn_diff_t *diff)
-{
- while (diff != NULL)
- {
- if (diff->type == svn_diff__type_conflict)
- {
- return TRUE;
- }
-
- diff = diff->next;
- }
-
- return FALSE;
-}
-
-svn_boolean_t
-svn_diff_contains_diffs(svn_diff_t *diff)
-{
- while (diff != NULL)
- {
- if (diff->type != svn_diff__type_common)
- {
- return TRUE;
- }
-
- diff = diff->next;
- }
-
- return FALSE;
-}
-
-svn_error_t *
-svn_diff_output(svn_diff_t *diff,
- void *output_baton,
- const svn_diff_output_fns_t *vtable)
-{
- svn_error_t *(*output_fn)(void *,
- apr_off_t, apr_off_t,
- apr_off_t, apr_off_t,
- apr_off_t, apr_off_t);
-
- while (diff != NULL)
- {
- switch (diff->type)
- {
- case svn_diff__type_common:
- output_fn = vtable->output_common;
- break;
-
- case svn_diff__type_diff_common:
- output_fn = vtable->output_diff_common;
- break;
-
- case svn_diff__type_diff_modified:
- output_fn = vtable->output_diff_modified;
- break;
-
- case svn_diff__type_diff_latest:
- output_fn = vtable->output_diff_latest;
- break;
-
- case svn_diff__type_conflict:
- output_fn = NULL;
- if (vtable->output_conflict != NULL)
- {
- SVN_ERR(vtable->output_conflict(output_baton,
- diff->original_start, diff->original_length,
- diff->modified_start, diff->modified_length,
- diff->latest_start, diff->latest_length,
- diff->resolved_diff));
- }
- break;
-
- default:
- output_fn = NULL;
- break;
- }
-
- if (output_fn != NULL)
- {
- SVN_ERR(output_fn(output_baton,
- diff->original_start, diff->original_length,
- diff->modified_start, diff->modified_length,
- diff->latest_start, diff->latest_length));
- }
-
- diff = diff->next;
- }
-
- return SVN_NO_ERROR;
-}
-
-
-void
-svn_diff__normalize_buffer(char **tgt,
- apr_off_t *lengthp,
- svn_diff__normalize_state_t *statep,
- const char *buf,
- const svn_diff_file_options_t *opts)
-{
- /* Variables for looping through BUF */
- const char *curp, *endp;
-
- /* Variable to record normalizing state */
- svn_diff__normalize_state_t state = *statep;
-
- /* Variables to track what needs copying into the target buffer */
- const char *start = buf;
- apr_size_t include_len = 0;
- svn_boolean_t last_skipped = FALSE; /* makes sure we set 'start' */
-
- /* Variable to record the state of the target buffer */
- char *tgt_newend = *tgt;
-
- /* If this is a noop, then just get out of here. */
- if (! opts->ignore_space && ! opts->ignore_eol_style)
- {
- *tgt = (char *)buf;
- return;
- }
-
-
- /* It only took me forever to get this routine right,
- so here my thoughts go:
-
- Below, we loop through the data, doing 2 things:
-
- - Normalizing
- - Copying other data
-
- The routine tries its hardest *not* to copy data, but instead
- returning a pointer into already normalized existing data.
-
- To this end, a block 'other data' shouldn't be copied when found,
- but only as soon as it can't be returned in-place.
-
- On a character level, there are 3 possible operations:
-
- - Skip the character (don't include in the normalized data)
- - Include the character (do include in the normalizad data)
- - Include as another character
- This is essentially the same as skipping the current character
- and inserting a given character in the output data.
-
- The macros below (SKIP, INCLUDE and INCLUDE_AS) are defined to
- handle the character based operations. The macros themselves
- collect character level data into blocks.
-
- At all times designate the START, INCLUDED_LEN and CURP pointers
- an included and and skipped block like this:
-
- [ start, start + included_len ) [ start + included_len, curp )
- INCLUDED EXCLUDED
-
- When the routine flips from skipping to including, the last
- included block has to be flushed to the output buffer.
- */
-
- /* Going from including to skipping; only schedules the current
- included section for flushing.
- Also, simply chop off the character if it's the first in the buffer,
- so we can possibly just return the remainder of the buffer */
-#define SKIP \
- do { \
- if (start == curp) \
- ++start; \
- last_skipped = TRUE; \
- } while (0)
-
-#define INCLUDE \
- do { \
- if (last_skipped) \
- COPY_INCLUDED_SECTION; \
- ++include_len; \
- last_skipped = FALSE; \
- } while (0)
-
-#define COPY_INCLUDED_SECTION \
- do { \
- if (include_len > 0) \
- { \
- memmove(tgt_newend, start, include_len); \
- tgt_newend += include_len; \
- include_len = 0; \
- } \
- start = curp; \
- } while (0)
-
- /* Include the current character as character X.
- If the current character already *is* X, add it to the
- currently included region, increasing chances for consecutive
- fully normalized blocks. */
-#define INCLUDE_AS(x) \
- do { \
- if (*curp == (x)) \
- INCLUDE; \
- else \
- { \
- INSERT((x)); \
- SKIP; \
- } \
- } while (0)
-
- /* Insert character X in the output buffer */
-#define INSERT(x) \
- do { \
- COPY_INCLUDED_SECTION; \
- *tgt_newend++ = (x); \
- } while (0)
-
- for (curp = buf, endp = buf + *lengthp; curp != endp; ++curp)
- {
- switch (*curp)
- {
- case '\r':
- if (opts->ignore_eol_style)
- INCLUDE_AS('\n');
- else
- INCLUDE;
- state = svn_diff__normalize_state_cr;
- break;
-
- case '\n':
- if (state == svn_diff__normalize_state_cr
- && opts->ignore_eol_style)
- SKIP;
- else
- INCLUDE;
- state = svn_diff__normalize_state_normal;
- break;
-
- default:
- if (svn_ctype_isspace(*curp)
- && opts->ignore_space != svn_diff_file_ignore_space_none)
- {
- /* Whitespace but not '\r' or '\n' */
- if (state != svn_diff__normalize_state_whitespace
- && opts->ignore_space
- == svn_diff_file_ignore_space_change)
- /*### If we can postpone insertion of the space
- until the next non-whitespace character,
- we have a potential of reducing the number of copies:
- If this space is followed by more spaces,
- this will cause a block-copy.
- If the next non-space block is considered normalized
- *and* preceded by a space, we can take advantage of that. */
- /* Note, the above optimization applies to 90% of the source
- lines in our own code, since it (generally) doesn't use
- more than one space per blank section, except for the
- beginning of a line. */
- INCLUDE_AS(' ');
- else
- SKIP;
- state = svn_diff__normalize_state_whitespace;
- }
- else
- {
- /* Non-whitespace character, or whitespace character in
- svn_diff_file_ignore_space_none mode. */
- INCLUDE;
- state = svn_diff__normalize_state_normal;
- }
- }
- }
-
- /* If we're not in whitespace, flush the last chunk of data.
- * Note that this will work correctly when this is the last chunk of the
- * file:
- * * If there is an eol, it will either have been output when we entered
- * the state_cr, or it will be output now.
- * * If there is no eol and we're not in whitespace, then we just output
- * everything below.
- * * If there's no eol and we are in whitespace, we want to ignore
- * whitespace unconditionally. */
-
- if (*tgt == tgt_newend)
- {
- /* we haven't copied any data in to *tgt and our chunk consists
- only of one block of (already normalized) data.
- Just return the block. */
- *tgt = (char *)start;
- *lengthp = include_len;
- }
- else
- {
- COPY_INCLUDED_SECTION;
- *lengthp = tgt_newend - *tgt;
- }
-
- *statep = state;
-
-#undef SKIP
-#undef INCLUDE
-#undef INCLUDE_AS
-#undef INSERT
-#undef COPY_INCLUDED_SECTION
-}
-
-
-/* Return the library version number. */
-const svn_version_t *
-svn_diff_version(void)
-{
- SVN_VERSION_BODY;
-}
Propchange: subversion/trunk/subversion/libsvn_subr/adler32.c
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: subversion/trunk/subversion/libsvn_subr/adler32.c
------------------------------------------------------------------------------
svn:mergeinfo =