Lines Matching refs:cp
45 char *cp = buf, tmp; in ltoa() local
50 *cp++ = '0' + (val % 10); in ltoa()
56 len = cp - buf; in ltoa()
57 --cp; in ltoa()
61 buf[i] = cp[-i]; in ltoa()
62 cp[-i] = tmp; in ltoa()
70 char path[sizeof ("/proc/0123456789/maps")], *cp; in maps_init() local
73 cp = ltoa (path + 6, pid); in maps_init()
74 assert (cp + 6 < path + sizeof (path)); in maps_init()
75 memcpy (cp, "/maps", 6); in maps_init()
82 cp = mmap (NULL, mi->buf_size, PROT_READ | PROT_WRITE, in maps_init()
84 if (cp == MAP_FAILED) in maps_init()
93 mi->buf = mi->buf_end = cp + mi->buf_size; in maps_init()
101 skip_whitespace (char *cp) in skip_whitespace() argument
103 if (!cp) in skip_whitespace()
106 while (*cp == ' ' || *cp == '\t') in skip_whitespace()
107 ++cp; in skip_whitespace()
108 return cp; in skip_whitespace()
112 scan_hex (char *cp, unsigned long *valp) in scan_hex() argument
116 cp = skip_whitespace (cp); in scan_hex()
117 if (!cp) in scan_hex()
122 digit = *cp; in scan_hex()
133 ++cp; in scan_hex()
138 return cp; in scan_hex()
142 scan_dec (char *cp, unsigned long *valp) in scan_dec() argument
146 if (!(cp = skip_whitespace (cp))) in scan_dec()
151 digit = *cp; in scan_dec()
155 ++cp; in scan_dec()
165 return cp; in scan_dec()
169 scan_char (char *cp, char *valp) in scan_char() argument
171 if (!cp) in scan_char()
174 *valp = *cp; in scan_char()
177 if (*cp) in scan_char()
178 ++cp; in scan_char()
179 return cp; in scan_char()
185 scan_string (char *cp, char *valp, size_t buf_size) in scan_string() argument
189 if (!(cp = skip_whitespace (cp))) in scan_string()
192 while (*cp != ' ' && *cp != '\t' && *cp != '\0') in scan_string()
195 valp[i++] = *cp; in scan_string()
196 ++cp; in scan_string()
201 return cp; in scan_string()
209 char perm[16], dash = 0, colon = 0, *cp; in maps_next() local
261 cp = mi->buf; in maps_next()
266 cp = scan_hex (cp, low); in maps_next()
267 cp = scan_char (cp, &dash); in maps_next()
268 cp = scan_hex (cp, high); in maps_next()
269 cp = scan_string (cp, perm, sizeof (perm)); in maps_next()
270 cp = scan_hex (cp, offset); in maps_next()
271 cp = scan_hex (cp, &major); in maps_next()
272 cp = scan_char (cp, &colon); in maps_next()
273 cp = scan_hex (cp, &minor); in maps_next()
274 cp = scan_dec (cp, &inum); in maps_next()
275 cp = mi->path = skip_whitespace (cp); in maps_next()
276 if (!cp) in maps_next()
278 cp = scan_string (cp, NULL, 0); in maps_next()