Skip to content

Commit 1987020

Browse files
authored
Fix incorrect function name and description for xdiff_string_rabdiff() (#4996)
1 parent 87d781c commit 1987020

File tree

1 file changed

+41
-16
lines changed

1 file changed

+41
-16
lines changed

reference/xdiff/functions/xdiff-string-rabdiff.xml

Lines changed: 41 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,34 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<!-- $Revision$ -->
3-
<!-- Generated by xml_proto.php v2.0. Found in /scripts directory of phpdoc. -->
43
<refentry xml:id="function.xdiff-string-rabdiff" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
54
<refnamediv>
65
<refname>xdiff_string_rabdiff</refname>
7-
<refpurpose>Make binary diff of two strings using the Rabin's polynomial fingerprinting algorithm</refpurpose>
6+
<refpurpose>
7+
Make a binary diff of two strings using the Rabin's polynomial fingerprinting algorithm
8+
</refpurpose>
89
</refnamediv>
9-
10+
1011
<refsect1 role="description">
1112
&reftitle.description;
1213
<methodsynopsis>
13-
<type>string</type><methodname>xdiff_string_bdiff</methodname>
14+
<type>string|false</type><methodname>xdiff_string_rabdiff</methodname>
1415
<methodparam><type>string</type><parameter>old_data</parameter></methodparam>
1516
<methodparam><type>string</type><parameter>new_data</parameter></methodparam>
1617
</methodsynopsis>
1718
<para>
18-
Makes a binary diff of two strings and returns the result.
19-
The difference between this function and <function>xdiff_string_bdiff</function> is different
20-
algorithm used which should result in faster execution and smaller diff produced.
21-
This function works with both text and binary data. Resulting patch
22-
can be later applied using <function>xdiff_string_bpatch</function>/<function>xdiff_file_bpatch</function>.
19+
Makes a binary diff of two strings using the Rabin's polynomial fingerprinting algorithm implemented by
20+
<link xlink:href="&url.xdiff;">libxdiff</link>. Compared to
21+
<function>xdiff_string_bdiff</function>, this algorithm generally produces smaller diffs and operates faster,
22+
while remaining fully compatible with <function>xdiff_string_bpatch</function> and
23+
<function>xdiff_file_bpatch</function> for applying patches.
24+
</para>
25+
<para>
26+
This function can be used with both text and binary data. The resulting diff data can later be
27+
applied to recreate the new version from the old one.
2328
</para>
2429
<para>
25-
For more details about differences between algorithm used please check <link xlink:href="&url.xdiff;">libxdiff</link>
26-
website.
30+
For further information about the algorithm, see the
31+
<link xlink:href="https://www.xmailserver.org/xdiff-lib.html">libxdiff documentation</link>.
2732
</para>
2833
</refsect1>
2934

@@ -35,15 +40,15 @@
3540
<term><parameter>old_data</parameter></term>
3641
<listitem>
3742
<para>
38-
First string with binary data. It acts as "old" data.
43+
The first string containing the "old" binary data.
3944
</para>
4045
</listitem>
4146
</varlistentry>
4247
<varlistentry>
4348
<term><parameter>new_data</parameter></term>
4449
<listitem>
4550
<para>
46-
Second string with binary data. It acts as "new" data.
51+
The second string containing the "new" binary data.
4752
</para>
4853
</listitem>
4954
</varlistentry>
@@ -54,22 +59,42 @@
5459
<refsect1 role="returnvalues">
5560
&reftitle.returnvalues;
5661
<para>
57-
Returns string with binary diff containing differences between "old" and "new"
58-
data or &false; if an internal error occurred.
62+
Returns a binary diff string containing the differences between the old and new data,&return.falseforfailure;.
63+
</para>
64+
</refsect1>
65+
66+
<refsect1 role="examples">
67+
&reftitle.examples;
68+
<para>
69+
<example>
70+
<title>Creation of a binary diff between two strings</title>
71+
<programlisting role="php">
72+
<![CDATA[
73+
<?php
74+
$old = file_get_contents('file_v1.txt');
75+
$new = file_get_contents('file_v2.txt');
76+
77+
$diff = xdiff_string_rabdiff($old, $new);
78+
file_put_contents('patch.rdiff', $diff);
79+
?>
80+
]]>
81+
</programlisting>
82+
</example>
5983
</para>
6084
</refsect1>
6185

6286
<refsect1 role="seealso">
6387
&reftitle.seealso;
6488
<para>
6589
<simplelist>
90+
<member><function>xdiff_string_bdiff</function></member>
6691
<member><function>xdiff_string_bpatch</function></member>
92+
<member><function>xdiff_file_bpatch</function></member>
6793
</simplelist>
6894
</para>
6995
</refsect1>
7096

7197
</refentry>
72-
7398
<!-- Keep this comment at the end of the file
7499
Local variables:
75100
mode: sgml

0 commit comments

Comments
 (0)