"git@developer.sourcefind.cn:zhaoyu6/sglang.git" did not exist on "72676cd6c0eead68286cf9c8df5c67f580ff477b"
Commit b5cf3e3b authored by Roy Macdonald's avatar Roy Macdonald Committed by Davis E. King
Browse files

Fixes issue with object named nil that collide with apple's definition. (#537)

* Fixes issue with object named nil that collide with apple's definition.

* fix nil named objects: changed name to no_parent
parent a23d726b
......@@ -162,9 +162,9 @@ namespace dlib
g.set_label(sink_node, SINK_CUT);
// used to indicate "no parent"
const unsigned long nil = g.number_of_nodes();
const unsigned long no_parent = g.number_of_nodes();
parent.assign(g.number_of_nodes(), nil);
parent.assign(g.number_of_nodes(), no_parent);
time = 1;
dist.assign(g.number_of_nodes(), 0);
......@@ -194,14 +194,14 @@ namespace dlib
private:
unsigned long distance_to_origin (
const unsigned long nil,
const unsigned long no_parent,
unsigned long p,
unsigned long
) const
{
unsigned long start = p;
unsigned long count = 0;
while (p != nil)
while (p != no_parent)
{
if (ts[p] == time)
{
......@@ -237,7 +237,7 @@ namespace dlib
typedef typename flow_graph::in_edge_iterator in_edge_iterator;
// used to indicate "no parent"
const unsigned long nil = g.number_of_nodes();
const unsigned long no_parent = g.number_of_nodes();
while (orphans.size() > 0)
{
......@@ -260,7 +260,7 @@ namespace dlib
if (g.get_label(id) != label_p || g.get_flow(q) <= 0 )
continue;
unsigned long temp = distance_to_origin(nil, id,source);
unsigned long temp = distance_to_origin(no_parent, id,source);
if (temp < best_dist)
{
best_dist = temp;
......@@ -276,7 +276,7 @@ namespace dlib
}
// if we didn't find a parent for p
if (parent[p] == nil)
if (parent[p] == no_parent)
{
for(in_edge_iterator q = begin; q != end; ++q)
{
......@@ -290,7 +290,7 @@ namespace dlib
if (parent[id] == p)
{
parent[id] = nil;
parent[id] = no_parent;
orphans.push_back(id);
}
}
......@@ -309,7 +309,7 @@ namespace dlib
if (g.get_label(id) != label_p || g.get_flow(q) <= 0)
continue;
unsigned long temp = distance_to_origin(nil, id,sink);
unsigned long temp = distance_to_origin(no_parent, id,sink);
if (temp < best_dist)
{
......@@ -326,7 +326,7 @@ namespace dlib
}
// if we didn't find a parent for p
if (parent[p] == nil)
if (parent[p] == no_parent)
{
for(out_edge_iterator q = begin; q != end; ++q)
{
......@@ -340,7 +340,7 @@ namespace dlib
if (parent[id] == p)
{
parent[id] = nil;
parent[id] = no_parent;
orphans.push_back(id);
}
}
......@@ -366,7 +366,7 @@ namespace dlib
typedef typename flow_graph::edge_type edge_type;
// used to indicate "no parent"
const unsigned long nil = g.number_of_nodes();
const unsigned long no_parent = g.number_of_nodes();
unsigned long s = source_side;
unsigned long t = sink_side;
......@@ -414,7 +414,7 @@ namespace dlib
g.adjust_flow(t,s, min_cap);
if (g.get_flow(s,t) <= 0)
{
parent[t] = nil;
parent[t] = no_parent;
orphans.push_back(t);
}
......@@ -429,7 +429,7 @@ namespace dlib
g.adjust_flow(t,s, min_cap);
if (g.get_flow(s,t) <= 0)
{
parent[s] = nil;
parent[s] = no_parent;
orphans.push_back(s);
}
s = t;
......
......@@ -42,12 +42,12 @@ namespace dlib
integer info = 0;
char sort = 'N';
L_fp fnil = 0;
logical nil = 0;
logical bwork = 0;
integer sdim = 0;
DLIB_FORTRAN_ID(dgees)(&jobvs, &sort, fnil, &n,
a, &lda, &sdim, wr,
wi, vs, &ldvs, work,
&lwork, &nil, &info);
&lwork, &bwork, &info);
return info;
}
......@@ -61,12 +61,12 @@ namespace dlib
integer info = 0;
char sort = 'N';
L_fp fnil = 0;
logical nil = 0;
logical bwork = 0;
integer sdim = 0;
DLIB_FORTRAN_ID(sgees)(&jobvs, &sort, fnil, &n,
a, &lda, &sdim, wr,
wi, vs, &ldvs, work,
&lwork, &nil, &info);
&lwork, &bwork, &info);
return info;
}
......
......@@ -18,7 +18,7 @@ namespace
logger dlog("test.tuple");
struct nil
struct s_nil
{
template <typename T>
void operator() (
......@@ -122,10 +122,10 @@ namespace
b = a;
inc i;
nil n;
s_nil n;
a.for_each(inc());
a.for_each(i);
const_cast<const T&>(a).for_each(nil());
const_cast<const T&>(a).for_each(s_nil());
const_cast<const T&>(a).for_each(n);
DLIB_TEST(a.get<0>() == b.get<0>()+2);
......@@ -145,7 +145,7 @@ namespace
a.for_index(i,0);
a.for_index(inc(),1);
const_cast<const T&>(a).for_index(n,2);
const_cast<const T&>(a).for_index(nil(),0);
const_cast<const T&>(a).for_index(s_nil(),0);
DLIB_TEST(a.get<0>() == b.get<0>()+1);
DLIB_TEST(a.get<1>() == b.get<1>()+1);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment