ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/JSON-XS/XS.xs
(Generate patch)

Comparing JSON-XS/XS.xs (file contents):
Revision 1.122 by root, Tue Oct 29 15:55:49 2013 UTC vs.
Revision 1.130 by root, Sat Nov 26 06:09:29 2016 UTC

6#include <string.h> 6#include <string.h>
7#include <stdlib.h> 7#include <stdlib.h>
8#include <stdio.h> 8#include <stdio.h>
9#include <limits.h> 9#include <limits.h>
10#include <float.h> 10#include <float.h>
11#include <inttypes.h>
11 12
12#if defined(__BORLANDC__) || defined(_MSC_VER) 13#if defined(__BORLANDC__) || defined(_MSC_VER)
13# define snprintf _snprintf // C compilers have this in stdio.h 14# define snprintf _snprintf // C compilers have this in stdio.h
14#endif 15#endif
15 16
79#define ERR_NESTING_EXCEEDED "json text or perl structure exceeds maximum nesting level (max_depth set too low?)" 80#define ERR_NESTING_EXCEEDED "json text or perl structure exceeds maximum nesting level (max_depth set too low?)"
80 81
81#ifdef USE_ITHREADS 82#ifdef USE_ITHREADS
82# define JSON_SLOW 1 83# define JSON_SLOW 1
83# define JSON_STASH (json_stash ? json_stash : gv_stashpv ("JSON::XS", 1)) 84# define JSON_STASH (json_stash ? json_stash : gv_stashpv ("JSON::XS", 1))
85# define BOOL_STASH (bool_stash ? bool_stash : gv_stashpv ("Types::Serialiser::Boolean", 1))
84#else 86#else
85# define JSON_SLOW 0 87# define JSON_SLOW 0
86# define JSON_STASH json_stash 88# define JSON_STASH json_stash
89# define BOOL_STASH bool_stash
87#endif 90#endif
88 91
89// the amount of HEs to allocate on the stack, when sorting keys 92// the amount of HEs to allocate on the stack, when sorting keys
90#define STACK_HES 64 93#define STACK_HES 64
91 94
92static HV *json_stash, *types_boolean_stash; // JSON::XS:: 95static HV *json_stash, *bool_stash; // JSON::XS::, Types::Serialiser::Boolean::
93static SV *types_true, *types_false, *sv_json; 96static SV *bool_true, *bool_false, *sv_json;
94 97
95enum { 98enum {
96 INCR_M_WS = 0, // initial whitespace skipping, must be 0 99 INCR_M_WS = 0, // initial whitespace skipping, must be 0
97 INCR_M_STR, // inside string 100 INCR_M_STR, // inside string
98 INCR_M_BS, // inside backslash 101 INCR_M_BS, // inside backslash
299 // a recursion depth of ten gives us >>500 bits 302 // a recursion depth of ten gives us >>500 bits
300 json_atof_scan1 (s, &accum, &expo, 0, 10); 303 json_atof_scan1 (s, &accum, &expo, 0, 10);
301 304
302 return neg ? -accum : accum; 305 return neg ? -accum : accum;
303} 306}
307
308// target of scalar reference is bool? -1 == nope, 0 == false, 1 == true
309static int
310ref_bool_type (SV *sv)
311{
312 svtype svt = SvTYPE (sv);
313
314 if (svt < SVt_PVAV)
315 {
316 STRLEN len = 0;
317 char *pv = svt ? SvPV (sv, len) : 0;
318
319 if (len == 1)
320 if (*pv == '1')
321 return 1;
322 else if (*pv == '0')
323 return 0;
324 }
325
326 return -1;
327}
328
329// returns whether scalar is not a reference in the sense of allow_nonref
330static int
331json_nonref (SV *scalar)
332{
333 if (!SvROK (scalar))
334 return 1;
335
336 scalar = SvRV (scalar);
337
338 if (SvTYPE (scalar) >= SVt_PVMG)
339 {
340 if (SvSTASH (scalar) == bool_stash)
341 return 1;
342
343 if (!SvOBJECT (scalar) && ref_bool_type (scalar) >= 0)
344 return 1;
345 }
346
347 return 0;
348}
349
304///////////////////////////////////////////////////////////////////////////// 350/////////////////////////////////////////////////////////////////////////////
305// encoder 351// encoder
306 352
307// structure used for encoding JSON 353// structure used for encoding JSON
308typedef struct 354typedef struct
316} enc_t; 362} enc_t;
317 363
318INLINE void 364INLINE void
319need (enc_t *enc, STRLEN len) 365need (enc_t *enc, STRLEN len)
320{ 366{
321 if (expect_false (enc->cur + len >= enc->end)) 367 if (expect_false ((uintptr_t)(enc->end - enc->cur) < len))
322 { 368 {
323 STRLEN cur = enc->cur - (char *)SvPVX (enc->sv); 369 STRLEN cur = enc->cur - (char *)SvPVX (enc->sv);
324 SvGROW (enc->sv, cur + (len < (cur >> 2) ? cur >> 2 : len) + 1); 370 SvGROW (enc->sv, cur + (len < (cur >> 2) ? cur >> 2 : len) + 1);
325 enc->cur = SvPVX (enc->sv) + cur; 371 enc->cur = SvPVX (enc->sv) + cur;
326 enc->end = SvPVX (enc->sv) + SvLEN (enc->sv) - 1; 372 enc->end = SvPVX (enc->sv) + SvLEN (enc->sv) - 1;
701 SvGETMAGIC (sv); 747 SvGETMAGIC (sv);
702 svt = SvTYPE (sv); 748 svt = SvTYPE (sv);
703 749
704 if (expect_false (SvOBJECT (sv))) 750 if (expect_false (SvOBJECT (sv)))
705 { 751 {
706 HV *boolean_stash = !JSON_SLOW || types_boolean_stash
707 ? types_boolean_stash
708 : gv_stashpv ("Types::Serialiser::Boolean", 1);
709 HV *stash = SvSTASH (sv); 752 HV *stash = SvSTASH (sv);
710 753
711 if (stash == boolean_stash) 754 if (stash == bool_stash)
712 { 755 {
713 if (SvIV (sv)) 756 if (SvIV (sv))
714 encode_str (enc, "true", 4, 0); 757 encode_str (enc, "true", 4, 0);
715 else 758 else
716 encode_str (enc, "false", 5, 0); 759 encode_str (enc, "false", 5, 0);
718 else if ((enc->json.flags & F_ALLOW_TAGS) && (method = gv_fetchmethod_autoload (stash, "FREEZE", 0))) 761 else if ((enc->json.flags & F_ALLOW_TAGS) && (method = gv_fetchmethod_autoload (stash, "FREEZE", 0)))
719 { 762 {
720 int count; 763 int count;
721 dSP; 764 dSP;
722 765
723 ENTER; SAVETMPS; PUSHMARK (SP); 766 ENTER; SAVETMPS;
767 SAVESTACK_POS ();
768 PUSHMARK (SP);
724 EXTEND (SP, 2); 769 EXTEND (SP, 2);
725 // we re-bless the reference to get overload and other niceties right 770 // we re-bless the reference to get overload and other niceties right
726 PUSHs (sv_bless (sv_2mortal (newRV_inc (sv)), stash)); 771 PUSHs (sv_bless (sv_2mortal (newRV_inc (sv)), stash));
727 PUSHs (sv_json); 772 PUSHs (sv_json);
728 773
730 count = call_sv ((SV *)GvCV (method), G_ARRAY); 775 count = call_sv ((SV *)GvCV (method), G_ARRAY);
731 SPAGAIN; 776 SPAGAIN;
732 777
733 // catch this surprisingly common error 778 // catch this surprisingly common error
734 if (SvROK (TOPs) && SvRV (TOPs) == sv) 779 if (SvROK (TOPs) && SvRV (TOPs) == sv)
735 croak ("%s::TO_JSON method returned same object as was passed instead of a new one", HvNAME (SvSTASH (sv))); 780 croak ("%s::FREEZE method returned same object as was passed instead of a new one", HvNAME (SvSTASH (sv)));
736 781
737 encode_ch (enc, '('); 782 encode_ch (enc, '(');
738 encode_ch (enc, '"'); 783 encode_ch (enc, '"');
739 encode_str (enc, HvNAME (stash), HvNAMELEN (stash), HvNAMEUTF8 (stash)); 784 encode_str (enc, HvNAME (stash), HvNAMELEN (stash), HvNAMEUTF8 (stash));
740 encode_ch (enc, '"'); 785 encode_ch (enc, '"');
749 encode_ch (enc, ','); 794 encode_ch (enc, ',');
750 } 795 }
751 796
752 encode_ch (enc, ']'); 797 encode_ch (enc, ']');
753 798
754 PUTBACK;
755
756 FREETMPS; LEAVE; 799 FREETMPS; LEAVE;
757 } 800 }
758 else if ((enc->json.flags & F_CONV_BLESSED) && (method = gv_fetchmethod_autoload (stash, "TO_JSON", 0))) 801 else if ((enc->json.flags & F_CONV_BLESSED) && (method = gv_fetchmethod_autoload (stash, "TO_JSON", 0)))
759 { 802 {
760 dSP; 803 dSP;
761 804
762 ENTER; SAVETMPS; PUSHMARK (SP); 805 ENTER; SAVETMPS;
806 PUSHMARK (SP);
763 // we re-bless the reference to get overload and other niceties right 807 // we re-bless the reference to get overload and other niceties right
764 XPUSHs (sv_bless (sv_2mortal (newRV_inc (sv)), stash)); 808 XPUSHs (sv_bless (sv_2mortal (newRV_inc (sv)), stash));
765 809
766 // calling with G_SCALAR ensures that we always get a 1 return value 810 // calling with G_SCALAR ensures that we always get a 1 return value
767 PUTBACK; 811 PUTBACK;
789 encode_hv (enc, (HV *)sv); 833 encode_hv (enc, (HV *)sv);
790 else if (svt == SVt_PVAV) 834 else if (svt == SVt_PVAV)
791 encode_av (enc, (AV *)sv); 835 encode_av (enc, (AV *)sv);
792 else if (svt < SVt_PVAV) 836 else if (svt < SVt_PVAV)
793 { 837 {
794 STRLEN len = 0; 838 int bool_type = ref_bool_type (sv);
795 char *pv = svt ? SvPV (sv, len) : 0;
796 839
797 if (len == 1 && *pv == '1') 840 if (bool_type == 1)
798 encode_str (enc, "true", 4, 0); 841 encode_str (enc, "true", 4, 0);
799 else if (len == 1 && *pv == '0') 842 else if (bool_type == 0)
800 encode_str (enc, "false", 5, 0); 843 encode_str (enc, "false", 5, 0);
801 else if (enc->json.flags & F_ALLOW_UNKNOWN) 844 else if (enc->json.flags & F_ALLOW_UNKNOWN)
802 encode_str (enc, "null", 4, 0); 845 encode_str (enc, "null", 4, 0);
803 else 846 else
804 croak ("cannot encode reference to scalar '%s' unless the scalar is 0 or 1", 847 croak ("cannot encode reference to scalar '%s' unless the scalar is 0 or 1",
887static SV * 930static SV *
888encode_json (SV *scalar, JSON *json) 931encode_json (SV *scalar, JSON *json)
889{ 932{
890 enc_t enc; 933 enc_t enc;
891 934
892 if (!(json->flags & F_ALLOW_NONREF) && !SvROK (scalar)) 935 if (!(json->flags & F_ALLOW_NONREF) && json_nonref (scalar))
893 croak ("hash- or arrayref expected (not a simple scalar, use allow_nonref to allow this)"); 936 croak ("hash- or arrayref expected (not a simple scalar, use allow_nonref to allow this)");
894 937
895 enc.json = *json; 938 enc.json = *json;
896 enc.sv = sv_2mortal (NEWSV (0, INIT_SIZE)); 939 enc.sv = sv_2mortal (NEWSV (0, INIT_SIZE));
897 enc.cur = SvPVX (enc.sv); 940 enc.cur = SvPVX (enc.sv);
1104 *cur++ = *dec_cur++; 1147 *cur++ = *dec_cur++;
1105 while (--clen); 1148 while (--clen);
1106 1149
1107 utf8 = 1; 1150 utf8 = 1;
1108 } 1151 }
1152 else if (ch == '\t' && dec->json.flags & F_RELAXED)
1153 *cur++ = ch;
1109 else 1154 else
1110 { 1155 {
1111 --dec_cur; 1156 --dec_cur;
1112 1157
1113 if (!ch) 1158 if (!ch)
1435 1480
1436 hv_iterinit (hv); 1481 hv_iterinit (hv);
1437 he = hv_iternext (hv); 1482 he = hv_iternext (hv);
1438 hv_iterinit (hv); 1483 hv_iterinit (hv);
1439 1484
1440 // the next line creates a mortal sv each time its called. 1485 // the next line creates a mortal sv each time it's called.
1441 // might want to optimise this for common cases. 1486 // might want to optimise this for common cases.
1442 cb = hv_fetch_ent (dec->json.cb_sk_object, hv_iterkeysv (he), 0, 0); 1487 cb = hv_fetch_ent (dec->json.cb_sk_object, hv_iterkeysv (he), 0, 0);
1443 1488
1444 if (cb) 1489 if (cb)
1445 { 1490 {
1446 dSP; 1491 dSP;
1447 int count; 1492 int count;
1448 1493
1449 ENTER; SAVETMPS; PUSHMARK (SP); 1494 ENTER; SAVETMPS;
1495 SAVESTACK_POS ();
1496 PUSHMARK (SP);
1450 XPUSHs (HeVAL (he)); 1497 XPUSHs (HeVAL (he));
1451 sv_2mortal (sv); 1498 sv_2mortal (sv);
1452 1499
1453 PUTBACK; count = call_sv (HeVAL (cb), G_ARRAY); SPAGAIN; 1500 PUTBACK; count = call_sv (HeVAL (cb), G_ARRAY); SPAGAIN;
1454 1501
1467 if (dec->json.cb_object) 1514 if (dec->json.cb_object)
1468 { 1515 {
1469 dSP; 1516 dSP;
1470 int count; 1517 int count;
1471 1518
1472 ENTER; SAVETMPS; PUSHMARK (SP); 1519 ENTER; SAVETMPS;
1520 SAVESTACK_POS ();
1521 PUSHMARK (SP);
1473 XPUSHs (sv_2mortal (sv)); 1522 XPUSHs (sv_2mortal (sv));
1474 1523
1475 PUTBACK; count = call_sv (dec->json.cb_object, G_ARRAY); SPAGAIN; 1524 PUTBACK; count = call_sv (dec->json.cb_object, G_ARRAY); SPAGAIN;
1476 1525
1477 if (count == 1) 1526 if (count == 1)
1544 if (!method) 1593 if (!method)
1545 ERR ("cannot decode perl-object (package does not have a THAW method)"); 1594 ERR ("cannot decode perl-object (package does not have a THAW method)");
1546 1595
1547 dSP; 1596 dSP;
1548 1597
1549 ENTER; SAVETMPS; PUSHMARK (SP); 1598 ENTER; SAVETMPS;
1599 PUSHMARK (SP);
1550 EXTEND (SP, len + 2); 1600 EXTEND (SP, len + 2);
1551 // we re-bless the reference to get overload and other niceties right 1601 // we re-bless the reference to get overload and other niceties right
1552 PUSHs (tag); 1602 PUSHs (tag);
1553 PUSHs (sv_json); 1603 PUSHs (sv_json);
1554 1604
1596 case 't': 1646 case 't':
1597 if (dec->end - dec->cur >= 4 && !memcmp (dec->cur, "true", 4)) 1647 if (dec->end - dec->cur >= 4 && !memcmp (dec->cur, "true", 4))
1598 { 1648 {
1599 dec->cur += 4; 1649 dec->cur += 4;
1600#if JSON_SLOW 1650#if JSON_SLOW
1601 types_true = get_bool ("Types::Serialiser::true"); 1651 bool_true = get_bool ("Types::Serialiser::true");
1602#endif 1652#endif
1603 return newSVsv (types_true); 1653 return newSVsv (bool_true);
1604 } 1654 }
1605 else 1655 else
1606 ERR ("'true' expected"); 1656 ERR ("'true' expected");
1607 1657
1608 break; 1658 break;
1610 case 'f': 1660 case 'f':
1611 if (dec->end - dec->cur >= 5 && !memcmp (dec->cur, "false", 5)) 1661 if (dec->end - dec->cur >= 5 && !memcmp (dec->cur, "false", 5))
1612 { 1662 {
1613 dec->cur += 5; 1663 dec->cur += 5;
1614#if JSON_SLOW 1664#if JSON_SLOW
1615 types_false = get_bool ("Types::Serialiser::false"); 1665 bool_false = get_bool ("Types::Serialiser::false");
1616#endif 1666#endif
1617 return newSVsv (types_false); 1667 return newSVsv (bool_false);
1618 } 1668 }
1619 else 1669 else
1620 ERR ("'false' expected"); 1670 ERR ("'false' expected");
1621 1671
1622 break; 1672 break;
1640fail: 1690fail:
1641 return 0; 1691 return 0;
1642} 1692}
1643 1693
1644static SV * 1694static SV *
1645decode_json (SV *string, JSON *json, char **offset_return) 1695decode_json (SV *string, JSON *json, STRLEN *offset_return)
1646{ 1696{
1647 dec_t dec; 1697 dec_t dec;
1648 SV *sv; 1698 SV *sv;
1649 1699
1650 /* work around bugs in 5.10 where manipulating magic values 1700 /* work around bugs in 5.10 where manipulating magic values
1651 * makes perl ignore the magic in subsequent accesses. 1701 * makes perl ignore the magic in subsequent accesses.
1652 * also make a copy of non-PV values, to get them into a clean 1702 * also make a copy of non-PV values, to get them into a clean
1653 * state (SvPV should do that, but it's buggy, see below). 1703 * state (SvPV should do that, but it's buggy, see below).
1704 *
1705 * SvIsCOW_shared_hash works around a bug in perl (possibly 5.16),
1706 * as reported by Reini Urban.
1654 */ 1707 */
1655 /*SvGETMAGIC (string);*/ 1708 /*SvGETMAGIC (string);*/
1656 if (SvMAGICAL (string) || !SvPOK (string)) 1709 if (SvMAGICAL (string) || !SvPOK (string) || SvIsCOW_shared_hash (string))
1657 string = sv_2mortal (newSVsv (string)); 1710 string = sv_2mortal (newSVsv (string));
1658 1711
1659 SvUPGRADE (string, SVt_PV); 1712 SvUPGRADE (string, SVt_PV);
1660 1713
1661 /* work around a bug in perl 5.10, which causes SvCUR to fail an 1714 /* work around a bug in perl 5.10, which causes SvCUR to fail an
1700 1753
1701 decode_ws (&dec); 1754 decode_ws (&dec);
1702 sv = decode_sv (&dec); 1755 sv = decode_sv (&dec);
1703 1756
1704 if (offset_return) 1757 if (offset_return)
1705 *offset_return = dec.cur; 1758 *offset_return = dec.cur - SvPVX (string);
1706 1759 else if (sv)
1707 if (!(offset_return || !sv))
1708 { 1760 {
1709 // check for trailing garbage 1761 // check for trailing garbage
1710 decode_ws (&dec); 1762 decode_ws (&dec);
1711 1763
1712 if (*dec.cur) 1764 if (*dec.cur)
1736 dec.cur != dec.end ? SvPV_nolen (uni) : "(end of string)"); 1788 dec.cur != dec.end ? SvPV_nolen (uni) : "(end of string)");
1737 } 1789 }
1738 1790
1739 sv = sv_2mortal (sv); 1791 sv = sv_2mortal (sv);
1740 1792
1741 if (!(dec.json.flags & F_ALLOW_NONREF) && !SvROK (sv)) 1793 if (!(dec.json.flags & F_ALLOW_NONREF) && json_nonref (sv))
1742 croak ("JSON text must be an object or array (but found number, string, true, false or null, use allow_nonref to allow this)"); 1794 croak ("JSON text must be an object or array (but found number, string, true, false or null, use allow_nonref to allow this)");
1743 1795
1744 return sv; 1796 return sv;
1745} 1797}
1746 1798
1916 i >= '0' && i <= '9' ? i - '0' 1968 i >= '0' && i <= '9' ? i - '0'
1917 : i >= 'a' && i <= 'f' ? i - 'a' + 10 1969 : i >= 'a' && i <= 'f' ? i - 'a' + 10
1918 : i >= 'A' && i <= 'F' ? i - 'A' + 10 1970 : i >= 'A' && i <= 'F' ? i - 'A' + 10
1919 : -1; 1971 : -1;
1920 1972
1921 json_stash = gv_stashpv ("JSON::XS" , 1); 1973 json_stash = gv_stashpv ("JSON::XS" , 1);
1922 types_boolean_stash = gv_stashpv ("Types::Serialiser::Boolean", 1); 1974 bool_stash = gv_stashpv ("Types::Serialiser::Boolean", 1);
1923
1924 types_true = get_bool ("Types::Serialiser::true"); 1975 bool_true = get_bool ("Types::Serialiser::true");
1925 types_false = get_bool ("Types::Serialiser::false"); 1976 bool_false = get_bool ("Types::Serialiser::false");
1926 1977
1927 sv_json = newSVpv ("JSON", 0); 1978 sv_json = newSVpv ("JSON", 0);
1928 SvREADONLY_on (sv_json); 1979 SvREADONLY_on (sv_json);
1929 1980
1930 CvNODEBUG_on (get_cv ("JSON::XS::incr_text", 0)); /* the debugger completely breaks lvalue subs */ 1981 CvNODEBUG_on (get_cv ("JSON::XS::incr_text", 0)); /* the debugger completely breaks lvalue subs */
1932 1983
1933PROTOTYPES: DISABLE 1984PROTOTYPES: DISABLE
1934 1985
1935void CLONE (...) 1986void CLONE (...)
1936 CODE: 1987 CODE:
1937 json_stash = 0; 1988 json_stash = 0;
1938 types_boolean_stash = 0; 1989 bool_stash = 0;
1939 1990
1940void new (char *klass) 1991void new (char *klass)
1941 PPCODE: 1992 PPCODE:
1942{ 1993{
1943 SV *pv = NEWSV (0, sizeof (JSON)); 1994 SV *pv = NEWSV (0, sizeof (JSON));
2060 2111
2061void decode_prefix (JSON *self, SV *jsonstr) 2112void decode_prefix (JSON *self, SV *jsonstr)
2062 PPCODE: 2113 PPCODE:
2063{ 2114{
2064 SV *sv; 2115 SV *sv;
2065 char *offset; 2116 STRLEN offset;
2066 PUTBACK; sv = decode_json (jsonstr, self, &offset); SPAGAIN; 2117 PUTBACK; sv = decode_json (jsonstr, self, &offset); SPAGAIN;
2067 EXTEND (SP, 2); 2118 EXTEND (SP, 2);
2068 PUSHs (sv); 2119 PUSHs (sv);
2069 PUSHs (sv_2mortal (newSVuv (ptr_to_index (jsonstr, offset)))); 2120 PUSHs (sv_2mortal (newSVuv (ptr_to_index (jsonstr, SvPV_nolen (jsonstr) + offset))));
2070} 2121}
2071 2122
2072void incr_parse (JSON *self, SV *jsonstr = 0) 2123void incr_parse (JSON *self, SV *jsonstr = 0)
2073 PPCODE: 2124 PPCODE:
2074{ 2125{
2121 2172
2122 if (GIMME_V != G_VOID) 2173 if (GIMME_V != G_VOID)
2123 do 2174 do
2124 { 2175 {
2125 SV *sv; 2176 SV *sv;
2126 char *offset; 2177 STRLEN offset;
2127 2178
2128 if (!INCR_DONE (self)) 2179 if (!INCR_DONE (self))
2129 { 2180 {
2130 incr_parse (self); 2181 incr_parse (self);
2131 2182
2147 } 2198 }
2148 2199
2149 PUTBACK; sv = decode_json (self->incr_text, self, &offset); SPAGAIN; 2200 PUTBACK; sv = decode_json (self->incr_text, self, &offset); SPAGAIN;
2150 XPUSHs (sv); 2201 XPUSHs (sv);
2151 2202
2152 self->incr_pos -= offset - SvPVX (self->incr_text); 2203 self->incr_pos -= offset;
2153 self->incr_nest = 0; 2204 self->incr_nest = 0;
2154 self->incr_mode = 0; 2205 self->incr_mode = 0;
2155 2206
2156 sv_chop (self->incr_text, offset); 2207 sv_chop (self->incr_text, SvPVX (self->incr_text) + offset);
2157 } 2208 }
2158 while (GIMME_V == G_ARRAY); 2209 while (GIMME_V == G_ARRAY);
2159} 2210}
2160 2211
2161SV *incr_text (JSON *self) 2212SV *incr_text (JSON *self)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines