MCPcopy Create free account
hub / github.com/F-Stack/f-stack / sbuf_trim

Function sbuf_trim

freebsd/kern/subr_sbuf.c:771–790  ·  view source on GitHub ↗

* Trim whitespace characters from end of an sbuf. */

Source from the content-addressed store, hash-verified

769 * Trim whitespace characters from end of an sbuf.
770 */
771int
772sbuf_trim(struct sbuf *s)
773{
774
775 assert_sbuf_integrity(s);
776 assert_sbuf_state(s, 0);
777 KASSERT(s->s_drain_func == NULL,
778 ("%s makes no sense on sbuf %p with drain", __func__, s));
779
780 if (s->s_error != 0)
781 return (-1);
782
783 while (s->s_len > 0 && isspace(s->s_buf[s->s_len-1])) {
784 --s->s_len;
785 if (SBUF_ISSECTION(s))
786 s->s_sect_len--;
787 }
788
789 return (0);
790}
791
792/*
793 * Check if an sbuf has an error.

Callers 7

kstat_sysctl_rawFunction · 0.85
mac_veriexec_print_stateFunction · 0.85
bcm2835_rng_attachFunction · 0.85
cpufreq_levels_sysctlFunction · 0.85
cpufreq_settings_sysctlFunction · 0.85
sys_abort2Function · 0.85

Calls 1

isspaceFunction · 0.85

Tested by

no test coverage detected