Lines Matching refs:str
37 char *str);
62 For PyBytes_FromString(), the parameter `str' points to a null-terminated
65 For PyBytes_FromStringAndSize(), the parameter `str' is
67 For PyBytes_FromStringAndSize(), the string in the `str' parameter does
70 If `str' is NULL then PyBytes_FromStringAndSize() will allocate `size+1'
72 fill in the data yourself. If `str' is non-NULL then the resulting
80 PyBytes_FromStringAndSize()) or the length of the string in the `str'
119 PyBytes_FromStringAndSize(const char *str, Py_ssize_t size)
127 if (size == 1 && str != NULL) {
128 op = CHARACTER(*str & 255);
139 if (str == NULL)
142 memcpy(op->ob_sval, str, size);
147 PyBytes_FromString(const char *str)
152 assert(str != NULL);
153 size = strlen(str);
164 op = CHARACTER(*str & 255);
179 memcpy(op->ob_sval, str, size+1);
209 #define WRITE_BYTES(str) \
211 s = _PyBytesWriter_WriteBytes(&writer, s, (str), strlen(str)); \
412 PyObject **p_result, _PyBytesWriter *writer, char *str)
440 str = _PyBytesWriter_Prepare(writer, str, len);
441 if (str == NULL) {
445 memcpy(str, p, len);
447 str += len;
448 return str;
454 return result != NULL ? str : NULL;
1385 "str() on a bytes instance", 1)) {
2312 encoding: str(c_default="NULL") = 'utf-8'
2314 errors: str(c_default="NULL") = 'strict'
2384 const Py_UCS1 *str, *end;
2410 str = PyUnicode_1BYTE_DATA(string);
2417 end = str + hexlen;
2418 while (str < end) {
2420 if (Py_ISSPACE(*str)) {
2422 str++;
2423 } while (Py_ISSPACE(*str));
2424 if (str >= end)
2428 top = _PyLong_DigitValue[*str];
2430 invalid_char = str - PyUnicode_1BYTE_DATA(string);
2433 str++;
2435 bot = _PyLong_DigitValue[*str];
2437 invalid_char = str - PyUnicode_1BYTE_DATA(string);
2440 str++;
2582 encoding: str = NULL
2583 errors: str = NULL
2702 char *str;
2707 str = _PyBytesWriter_Alloc(&writer, size);
2708 if (str == NULL)
2728 str = _PyBytesWriter_Resize(&writer, str, size+1);
2729 if (str == NULL)
2733 *str++ = (char) value;
2735 return _PyBytesWriter_Finish(&writer, str);
2748 char *str;
2754 str = ((PyBytesObject *)bytes)->ob_sval;
2767 *str++ = (char) value;
2779 char *str;
2789 str = _PyBytesWriter_Alloc(&writer, size);
2790 if (str == NULL)
2823 str = _PyBytesWriter_Resize(&writer, str, size+1);
2824 if (str == NULL)
2828 *str++ = (char) value;
2831 return _PyBytesWriter_Finish(&writer, str);
3331 _PyBytesWriter_GetSize(_PyBytesWriter *writer, char *str)
3334 assert(str != NULL);
3335 assert(str >= start);
3336 assert(str - start <= writer->allocated);
3337 return str - start;
3342 _PyBytesWriter_CheckConsistency(_PyBytesWriter *writer, char *str)
3371 assert(str != NULL);
3372 assert(start <= str && str <= end);
3378 _PyBytesWriter_Resize(_PyBytesWriter *writer, void *str, Py_ssize_t size)
3382 assert(_PyBytesWriter_CheckConsistency(writer, str));
3392 pos = _PyBytesWriter_GetSize(writer, str);
3438 str = _PyBytesWriter_AsString(writer) + pos;
3439 assert(_PyBytesWriter_CheckConsistency(writer, str));
3440 return str;
3448 _PyBytesWriter_Prepare(_PyBytesWriter *writer, void *str, Py_ssize_t size)
3452 assert(_PyBytesWriter_CheckConsistency(writer, str));
3457 return str;
3468 str = _PyBytesWriter_Resize(writer, str, new_min_size);
3471 return str;
3508 _PyBytesWriter_Finish(_PyBytesWriter *writer, void *str)
3513 assert(_PyBytesWriter_CheckConsistency(writer, str));
3515 size = _PyBytesWriter_GetSize(writer, str);
3555 char *str = (char *)ptr;
3557 str = _PyBytesWriter_Prepare(writer, str, size);
3558 if (str == NULL)
3561 memcpy(str, bytes, size);
3562 str += size;
3564 return str;