File tree Expand file tree Collapse file tree 10 files changed +50
-38
lines changed Expand file tree Collapse file tree 10 files changed +50
-38
lines changed Original file line number Diff line number Diff line change 11* .pyc
2+ .eggs /
23.coverage
34.cache /*
45build /*
Original file line number Diff line number Diff line change @@ -58,37 +58,5 @@ typedef struct _table_t
5858 entry_t * entries ; // Entries in the table
5959} table_t ;
6060
61-
62- // Table management methods (mostly here for the CFFI wrapper)
63- static table_t * new_table (unsigned int size )
64- {
65- // Malloc space for the table and associated entries
66- table_t * table = MALLOC (sizeof (table_t ));
67- table -> size = 0 ;
68- table -> entries = NULL ;
69-
70- if (table != NULL )
71- {
72- table -> entries = MALLOC (sizeof (entry_t ) * size );
73-
74- if (table -> entries != NULL )
75- {
76- table -> size = size ;
77- return table ;
78- }
79- }
80-
81- return NULL ;
82- }
83-
84- static void free_table (table_t * table )
85- {
86- // Free the entries and then the table
87- FREE (table -> entries );
88- table -> entries = NULL ;
89- table -> size = 0 ;
90- FREE (table );
91- }
92-
9361#define __ROUTING_TABLE_H__
9462#endif // __ROUTING_TABLE_H__
Original file line number Diff line number Diff line change 11"""Faster C implementation of common routing table minimisers."""
22from rig_routing_tables .version import __version__
33
4- from rig_routing_tables ._rig_routing_tables import ffi , lib
54from rig_routing_tables import utils
Original file line number Diff line number Diff line change 1212 #include "mtrie.h"
1313 #include "routing_table.h"
1414 #include "ordered_covering.h"
15+ #include "cffi_utils.h"
1516 """ ,
16- include_dirs = [include_dir ]
17+ include_dirs = [include_dir , os .path .dirname (__file__ )],
18+ sources = [os .path .join (os .path .dirname (__file__ ), "cffi_utils.c" )],
1719)
1820
1921ffi .cdef ("""
Original file line number Diff line number Diff line change 1+ #include <stdlib.h>
2+ #include <stddef.h>
3+ #include "cffi_utils.h"
4+
5+ table_t * new_table (unsigned int size )
6+ {
7+ // Malloc space for the table and associated entries
8+ table_t * table = malloc (sizeof (table_t ));
9+ table -> size = 0 ;
10+ table -> entries = NULL ;
11+
12+ if (table != NULL )
13+ {
14+ table -> entries = malloc (sizeof (entry_t ) * size );
15+
16+ if (table -> entries != NULL )
17+ {
18+ table -> size = size ;
19+ return table ;
20+ }
21+ }
22+
23+ return NULL ;
24+ }
25+
26+ void free_table (table_t * table )
27+ {
28+ // Free the entries and then the table
29+ free (table -> entries );
30+ table -> entries = NULL ;
31+ table -> size = 0 ;
32+ free (table );
33+ }
Original file line number Diff line number Diff line change 1+ #include "routing_table.h"
2+
3+ // Table management methods (mostly here for the CFFI wrapper)
4+ table_t * new_table (unsigned int size );
5+ void free_table (table_t * table );
Original file line number Diff line number Diff line change 11from rig .routing_table import MinimisationFailedError
22from rig_routing_tables .utils import rig_to_c_table , c_to_rig_table
3- from rig_routing_tables . _rig_routing_tables import lib
3+ from _rig_routing_tables import lib
44
55
66def minimise (table , target_length ):
Original file line number Diff line number Diff line change 11from rig .routing_table import MinimisationFailedError
22from rig_routing_tables .utils import rig_to_c_table , c_to_rig_table
3- from rig_routing_tables . _rig_routing_tables import lib
3+ from _rig_routing_tables import lib
44
55
66def minimise (table , target_length , no_raise = False ):
Original file line number Diff line number Diff line change 11"""Utilities for converting routing tables between different formats."""
22from rig .routing_table import RoutingTableEntry , Routes
3- from rig_routing_tables import ffi , lib
3+ from _rig_routing_tables import ffi , lib
44
55
66def rig_to_c_table (table ):
Original file line number Diff line number Diff line change 99 packages = find_packages (),
1010
1111 # Files required by CFFI wrapper
12- package_data = {'rig_routing_tables' : ['../include/*.h' ]},
12+ package_data = {
13+ 'rig_routing_tables' : ['../include/*.h' ,
14+ 'rig_routing_tables/cffi_utils.c' ,
15+ 'rig_routing_tables/cffi_utils.h' ]
16+ },
1317
1418 # Metadata for PyPi
1519 url = "https://github.com/project-rig/rig_routing_tables" ,
You can’t perform that action at this time.
0 commit comments