]> granicus.if.org Git - php/commitdiff
Convert CRLF line endings to LF
authorPeter Kokot <peterkokot@gmail.com>
Tue, 7 May 2019 02:40:01 +0000 (04:40 +0200)
committerPeter Kokot <peterkokot@gmail.com>
Tue, 7 May 2019 02:40:01 +0000 (04:40 +0200)
This patch simplifies line endings tracked in the Git repository and
syncs them to all include the LF style instead of the CRLF files.

Newline characters:
- LF (\n) (*nix and Mac)
- CRLF (\r\n) (Windows)
- CR (\r) (old Mac, obsolete)

To see which line endings are in the index and in the working copy the
following command can be used:
`git ls-files --eol`

Git additionally provides `.gitattributes` file to specify if some files
need to have specific line endings on all platforms (either CRLF or LF).

Changed files shouldn't cause issues on modern Windows platforms because
also Git can do output conversion is core.autocrlf=true is set on
Windows and use CRLF newlines in all files in the working tree.

Unless CRLF files are tracked specifically, Git by default tracks all
files in the index using LF newlines.

ext/ffi/tests/300.h
ext/ffi/tests/list.phpt

index 3426ec182d765a2d6084bea24b4e588dccd19453..b2f4e5ddc732e6b71bb30d7ee8ff7a1d5ce08da8 100644 (file)
@@ -1,3 +1,3 @@
-#define FFI_SCOPE "TEST_300"\r
-\r
-int printf(const char *format, ...);\r
+#define FFI_SCOPE "TEST_300"
+
+int printf(const char *format, ...);
index 9a8f25ed4f8043c6b56dbc155c6a0b85442aa901..a7696fa091cff206ec05a86993c8a40658ba8076 100644 (file)
@@ -1,95 +1,95 @@
---TEST--\r
-FFI Double linked lists\r
---SKIPIF--\r
-<?php require_once('skipif.inc'); ?>\r
---INI--\r
-ffi.enable=1\r
---FILE--\r
-<?php\r
-class DList {\r
-       private static $ffi = null;\r
-       private $root;\r
-\r
-       function __construct() {\r
-               if (is_null(self::$ffi)) {\r
-                       self::$ffi =\r
-                               FFI::cdef("\r
-                                       typedef struct _dlist dlist;\r
-                                       struct _dlist {\r
-                                               int data;\r
-                                               dlist *prev;\r
-                                               dlist *next;\r
-                                       };\r
-                               ");\r
-               }\r
-               $node = FFI::addr(self::$ffi->new("dlist", false));\r
-               $node->data = 0;\r
-               $node->next = $node;\r
-               $node->prev = $node;\r
-               $this->root = $node;\r
-       }\r
-\r
-       function __destruct() {\r
-               $root = $this->root;\r
-               $node = $root->next;\r
-               while ($node != $root) {\r
-                       $prev = $node;\r
-                       $node = $node->next;\r
-                       FFI::free($prev);\r
-               }\r
-               FFI::free($root);\r
-       }\r
-\r
-       function add(int $data) {\r
-               $node = FFI::addr(self::$ffi->new("dlist", false));\r
-               $node->data = $data;\r
-               $node->next = $this->root;\r
-               $node->prev = $this->root->prev;\r
-               $this->root->prev->next = $node;\r
-               $this->root->prev = $node;\r
-       }\r
-\r
-       function del(int $data) {\r
-               $root = $this->root;\r
-               $node = $root->next;\r
-               while ($node != $root) {\r
-                       if ($node->data == $data) {\r
-                               $node->prev->next = $node->next;\r
-                               $node->next->prev = $node->prev;\r
-                               FFI::free($node);\r
-                               break;\r
-                       }\r
-                       $node = $node->next;\r
-               }\r
-       }\r
-\r
-       function print() {\r
-               echo "[";\r
-               $first = true;\r
-               $root = $this->root;\r
-               $node = $root->next;\r
-               while ($node != $root) {\r
-                       if (!$first) {\r
-                               echo ", ";\r
-                       } else {\r
-                               $first = false;\r
-                       }\r
-                       echo $node->data;\r
-                       $node = $node->next;\r
-               }\r
-               echo "]\n";\r
-       }\r
-}\r
-\r
-$dlist = new Dlist;\r
-$dlist->add(1);\r
-$dlist->add(3);\r
-$dlist->add(5);\r
-$dlist->print();\r
-$dlist->del(3);\r
-$dlist->print();\r
-echo "OK\n";\r
---EXPECT--\r
-[1, 3, 5]\r
-[1, 5]\r
-OK\r
+--TEST--
+FFI Double linked lists
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--INI--
+ffi.enable=1
+--FILE--
+<?php
+class DList {
+       private static $ffi = null;
+       private $root;
+
+       function __construct() {
+               if (is_null(self::$ffi)) {
+                       self::$ffi =
+                               FFI::cdef("
+                                       typedef struct _dlist dlist;
+                                       struct _dlist {
+                                               int data;
+                                               dlist *prev;
+                                               dlist *next;
+                                       };
+                               ");
+               }
+               $node = FFI::addr(self::$ffi->new("dlist", false));
+               $node->data = 0;
+               $node->next = $node;
+               $node->prev = $node;
+               $this->root = $node;
+       }
+
+       function __destruct() {
+               $root = $this->root;
+               $node = $root->next;
+               while ($node != $root) {
+                       $prev = $node;
+                       $node = $node->next;
+                       FFI::free($prev);
+               }
+               FFI::free($root);
+       }
+
+       function add(int $data) {
+               $node = FFI::addr(self::$ffi->new("dlist", false));
+               $node->data = $data;
+               $node->next = $this->root;
+               $node->prev = $this->root->prev;
+               $this->root->prev->next = $node;
+               $this->root->prev = $node;
+       }
+
+       function del(int $data) {
+               $root = $this->root;
+               $node = $root->next;
+               while ($node != $root) {
+                       if ($node->data == $data) {
+                               $node->prev->next = $node->next;
+                               $node->next->prev = $node->prev;
+                               FFI::free($node);
+                               break;
+                       }
+                       $node = $node->next;
+               }
+       }
+
+       function print() {
+               echo "[";
+               $first = true;
+               $root = $this->root;
+               $node = $root->next;
+               while ($node != $root) {
+                       if (!$first) {
+                               echo ", ";
+                       } else {
+                               $first = false;
+                       }
+                       echo $node->data;
+                       $node = $node->next;
+               }
+               echo "]\n";
+       }
+}
+
+$dlist = new Dlist;
+$dlist->add(1);
+$dlist->add(3);
+$dlist->add(5);
+$dlist->print();
+$dlist->del(3);
+$dlist->print();
+echo "OK\n";
+--EXPECT--
+[1, 3, 5]
+[1, 5]
+OK