MCPcopy Create free account
hub / github.com/boostorg/build / set_explicit_binding

Function set_explicit_binding

v2/engine/search.c:76–118  ·  view source on GitHub ↗

Records the binding of a target with an explicit LOCATE. */

Source from the content-addressed store, hash-verified

74
75/* Records the binding of a target with an explicit LOCATE. */
76void set_explicit_binding( OBJECT * target, OBJECT * locate )
77{
78 OBJECT * boundname;
79 OBJECT * key;
80 PATHNAME f[ 1 ];
81 string buf[ 1 ];
82 int found;
83 BINDING * ba;
84
85 if ( !explicit_bindings )
86 explicit_bindings = hashinit( sizeof( BINDING ), "explicitly specified "
87 "locations" );
88
89 string_new( buf );
90
91 /* Parse the filename. */
92 path_parse( object_str( target ), f );
93
94 /* Ignore the grist. */
95 f->f_grist.ptr = 0;
96 f->f_grist.len = 0;
97
98 /* Root the target path at the given location. */
99 f->f_root.ptr = object_str( locate );
100 f->f_root.len = strlen( object_str( locate ) );
101
102 path_build( f, buf );
103 boundname = object_new( buf->value );
104 if ( DEBUG_SEARCH )
105 printf( "explicit locate %s: %s\n", object_str( target ), buf->value );
106 string_free( buf );
107 key = path_as_key( boundname );
108 object_free( boundname );
109
110 ba = (BINDING *)hash_insert( explicit_bindings, key, &found );
111 if ( !found )
112 {
113 ba->binding = key;
114 ba->target = target;
115 }
116 else
117 object_free( key );
118}
119
120/*
121 * search.c - find a target along $(SEARCH) or $(LOCATE).

Callers 1

Calls 10

hashinitFunction · 0.85
string_newFunction · 0.85
path_parseFunction · 0.85
object_strFunction · 0.85
path_buildFunction · 0.85
object_newFunction · 0.85
string_freeFunction · 0.85
object_freeFunction · 0.85
hash_insertFunction · 0.85
path_as_keyFunction · 0.70

Tested by

no test coverage detected