Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(2187)

Side by Side Diff: Python/getargs.c

Issue 14746: Remove redundant paragraphs from getargs.c skipitem()
Patch Set: Created 1 year, 1 month ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 1
2 /* New getargs implementation */ 2 /* New getargs implementation */
3 3
4 #include "Python.h" 4 #include "Python.h"
5 5
6 #include <ctype.h> 6 #include <ctype.h>
7 7
8 8
9 #ifdef __cplusplus 9 #ifdef __cplusplus
10 extern "C" { 10 extern "C" {
(...skipping 1591 matching lines...) Expand 10 before | Expand all | Expand 10 after
1602 1602
1603 1603
1604 static char * 1604 static char *
1605 skipitem(const char **p_format, va_list *p_va, int flags) 1605 skipitem(const char **p_format, va_list *p_va, int flags)
1606 { 1606 {
1607 const char *format = *p_format; 1607 const char *format = *p_format;
1608 char c = *format++; 1608 char c = *format++;
1609 1609
1610 switch (c) { 1610 switch (c) {
1611 1611
1612 /* simple codes 1612 /*
1613 * The individual types (second arg of va_arg) are irrelevant */ 1613 * codes that take a single pointer as an argument
1614 * (the type of the pointer is irrelevant)
1615 */
1614 1616
1615 case 'b': /* byte -- very short int */ 1617 case 'b': /* byte -- very short int */
1616 case 'B': /* byte as bitfield */ 1618 case 'B': /* byte as bitfield */
1617 case 'h': /* short int */ 1619 case 'h': /* short int */
1618 case 'H': /* short int as bitfield */ 1620 case 'H': /* short int as bitfield */
1619 case 'i': /* int */ 1621 case 'i': /* int */
1620 case 'I': /* int sized bitfield */ 1622 case 'I': /* int sized bitfield */
1621 case 'l': /* long int */ 1623 case 'l': /* long int */
1622 case 'k': /* long int sized bitfield */ 1624 case 'k': /* long int sized bitfield */
1623 #ifdef HAVE_LONG_LONG 1625 #ifdef HAVE_LONG_LONG
1624 case 'L': /* PY_LONG_LONG */ 1626 case 'L': /* PY_LONG_LONG */
1625 case 'K': /* PY_LONG_LONG sized bitfield */ 1627 case 'K': /* PY_LONG_LONG sized bitfield */
1626 #endif 1628 #endif
1629 case 'n': /* Py_ssize_t */
1627 case 'f': /* float */ 1630 case 'f': /* float */
1628 case 'd': /* double */ 1631 case 'd': /* double */
1629 case 'D': /* complex double */ 1632 case 'D': /* complex double */
1630 case 'c': /* char */ 1633 case 'c': /* char */
1631 case 'C': /* unicode char */ 1634 case 'C': /* unicode char */
1632 case 'p': /* boolean predicate */ 1635 case 'p': /* boolean predicate */
1636 case 'S': /* string object */
1637 case 'Y': /* string object */
1638 case 'U': /* unicode string object */
1633 { 1639 {
1634 (void) va_arg(*p_va, void *); 1640 (void) va_arg(*p_va, void *);
1635 break;
1636 }
1637
1638 case 'n': /* Py_ssize_t */
1639 {
1640 (void) va_arg(*p_va, Py_ssize_t *);
1641 break; 1641 break;
1642 } 1642 }
1643 1643
1644 /* string codes */ 1644 /* string codes */
1645 1645
1646 case 'e': /* string with encoding */ 1646 case 'e': /* string with encoding */
1647 { 1647 {
1648 (void) va_arg(*p_va, const char *); 1648 (void) va_arg(*p_va, const char *);
1649 if (!(*format == 's' || *format == 't')) 1649 if (!(*format == 's' || *format == 't'))
1650 /* after 'e', only 's' and 't' is allowed */ 1650 /* after 'e', only 's' and 't' is allowed */
(...skipping 12 matching lines...) Expand all
1663 (void) va_arg(*p_va, char **); 1663 (void) va_arg(*p_va, char **);
1664 if (*format == '#') { 1664 if (*format == '#') {
1665 if (flags & FLAG_SIZE_T) 1665 if (flags & FLAG_SIZE_T)
1666 (void) va_arg(*p_va, Py_ssize_t *); 1666 (void) va_arg(*p_va, Py_ssize_t *);
1667 else 1667 else
1668 (void) va_arg(*p_va, int *); 1668 (void) va_arg(*p_va, int *);
1669 format++; 1669 format++;
1670 } else if ((c == 's' || c == 'z' || c == 'y') && *format == '*') { 1670 } else if ((c == 's' || c == 'z' || c == 'y') && *format == '*') {
1671 format++; 1671 format++;
1672 } 1672 }
1673 break;
1674 }
1675
1676 /* object codes */
1677
1678 case 'S': /* string object */
1679 case 'Y': /* string object */
1680 case 'U': /* unicode string object */
1681 {
1682 (void) va_arg(*p_va, PyObject **);
1683 break; 1673 break;
1684 } 1674 }
1685 1675
1686 case 'O': /* object */ 1676 case 'O': /* object */
1687 { 1677 {
1688 if (*format == '!') { 1678 if (*format == '!') {
1689 format++; 1679 format++;
1690 (void) va_arg(*p_va, PyTypeObject*); 1680 (void) va_arg(*p_va, PyTypeObject*);
1691 (void) va_arg(*p_va, PyObject **); 1681 (void) va_arg(*p_va, PyObject **);
1692 } 1682 }
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
1810 if (PyDict_Size(kw) == 0) 1800 if (PyDict_Size(kw) == 0)
1811 return 1; 1801 return 1;
1812 1802
1813 PyErr_Format(PyExc_TypeError, "%s does not take keyword arguments", 1803 PyErr_Format(PyExc_TypeError, "%s does not take keyword arguments",
1814 funcname); 1804 funcname);
1815 return 0; 1805 return 0;
1816 } 1806 }
1817 #ifdef __cplusplus 1807 #ifdef __cplusplus
1818 }; 1808 };
1819 #endif 1809 #endif
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

RSS Feeds Recent Issues | This issue
This is Rietveld cbc36f91f3f7