Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 74 lines (59 sloc) 2.176 kb
2bca68e @derickr - Implemented dead code analysis that should give much better code co…
authored
1 /*
2 +----------------------------------------------------------------------+
3 | Xdebug |
4 +----------------------------------------------------------------------+
9d66b91 @derickr Welcome 2012.
authored
5 | Copyright (c) 2002-2012 Derick Rethans |
2bca68e @derickr - Implemented dead code analysis that should give much better code co…
authored
6 +----------------------------------------------------------------------+
7 | This source file is subject to version 1.0 of the Xdebug license, |
8 | that is bundled with this package in the file LICENSE, and is |
9 | available at through the world-wide-web at |
10 | http://xdebug.derickrethans.nl/license.php |
11 | If you did not receive a copy of the Xdebug license and are unable |
12 | to obtain it through the world-wide-web, please send a note to |
13 | xdebug@derickrethans.nl so we can mail you a copy immediately. |
14 +----------------------------------------------------------------------+
15 | Authors: Derick Rethans <derick@xdebug.org> |
16 +----------------------------------------------------------------------+
17 */
05871b5 @derickr - Happy 2010!
authored
18 /* $Id: xdebug_set.c,v 1.5 2010-05-07 20:39:13 derick Exp $ */
2bca68e @derickr - Implemented dead code analysis that should give much better code co…
authored
19
20 #include <stdlib.h>
21 #include <math.h>
22 #include "xdebug_set.h"
23
24 xdebug_set *xdebug_set_create(unsigned int size)
25 {
26 xdebug_set *tmp;
27
28 tmp = calloc(1, sizeof(xdebug_set));
29 tmp->size = size;
c60ea8f @derickr - Allocate one byte more because of safety.
authored
30 size = ceil((size + 7) / 8) + 1;
2bca68e @derickr - Implemented dead code analysis that should give much better code co…
authored
31 tmp->setinfo = calloc(1, size);
32
33 return tmp;
34 }
35
36 void xdebug_set_free(xdebug_set *set)
37 {
38 free(set->setinfo);
39 free(set);
40 }
41
42 void xdebug_set_add(xdebug_set *set, unsigned int position)
43 {
170b02f @derickr - Use PG(html_errors) instead of checking for CLI.
authored
44 unsigned char *byte;
45 unsigned int bit;
46
2bca68e @derickr - Implemented dead code analysis that should give much better code co…
authored
47 byte = &(set->setinfo[position / 8]);
48 bit = position % 8;
49
50 *byte = *byte | 1 << bit;
51 }
52
53 void xdebug_set_remove(xdebug_set *set, unsigned int position)
54 {
170b02f @derickr - Use PG(html_errors) instead of checking for CLI.
authored
55 unsigned char *byte;
56 unsigned int bit;
2bca68e @derickr - Implemented dead code analysis that should give much better code co…
authored
57
58 byte = &(set->setinfo[position / 8]);
59 bit = position % 8;
60
61 *byte = *byte & ~(1 << bit);
62 }
63
64 int xdebug_set_in_ex(xdebug_set *set, unsigned int position, int noisy)
65 {
170b02f @derickr - Use PG(html_errors) instead of checking for CLI.
authored
66 unsigned char *byte;
67 unsigned int bit;
2bca68e @derickr - Implemented dead code analysis that should give much better code co…
authored
68
69 byte = &(set->setinfo[position / 8]);
70 bit = position % 8;
71
72 return (*byte & (1 << bit));
73 }
Something went wrong with that request. Please try again.