| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
redis_cmd_append_sstr frames one RESP bulk argument and runs for every argument of every command (the hottest packing symbol; all the typed _int/_long/_dbl/_zval/_zstr/_key appenders funnel through it). It did five separately bounds-checked smart_string appends per argument. Format the length prefix up front so the whole frame size is known, reserve it with one smart_string_alloc, then write the frame directly. Same bytes on the wire; one capacity check instead of five. A ZEND_ASSERT documents the existing non-negative-length precondition (a negative length would mean a caller truncated a >INT_MAX size_t into the int parameter; that int-length contract is pervasive in the packing layer and unchanged here). Verified on PHP 8.4: value lengths across page boundaries (0, 4095/96/97, 65535/36, 1MB), large/negative integer args, float scores, binary key/value with NUL+CRLF, 500-arg MGET, 300-field HSET, no leaks under report_memleaks, and 33/34 project suite methods (the one failure, testXRange, fails identically on develop and is unrelated).
| Back | FazBrowse Home | New Git URL |
redis_cmd_append_sstr frames one RESP bulk argument ($<len>\r\n<data>\r\n) and runs for every argument of every command; all the typed _int/_long/_dbl/_zval/_zstr/_key appenders funnel through it. It did five separately bounds-checked smart_string appends per argument. This formats the length prefix up front so the whole frame size is known, reserves it with one smart_string_alloc, then writes the frame directly: same bytes on the wire, one capacity check instead of five. A ZEND_ASSERT documents the existing non-negative-length precondition.
Verified on PHP 8.4 across value lengths spanning page boundaries, large and negative integer args, floats, binary payloads with NUL and CRLF, and high-arity MGET/HSET: no leaks, 33/34 project suite methods pass (the one failure, testXRange, fails identically on develop). Buffer math and reply-type equivalence were independently reviewed.