summaryrefslogtreecommitdiffstats
path: root/db/mork/src
diff options
context:
space:
mode:
authorMatt A. Tobin <email@mattatobin.com>2019-11-11 01:49:50 -0500
committerMatt A. Tobin <email@mattatobin.com>2019-11-11 01:49:50 -0500
commita081e71becb76a90ba6bd82ceb27ce2e0274ea36 (patch)
tree8ab2a38c09255adbf81d155c3acfe58b6211f38c /db/mork/src
parent64f423eb409bbd77e0c9e59e5cfefdfedb472adc (diff)
downloadUXP-a081e71becb76a90ba6bd82ceb27ce2e0274ea36.tar
UXP-a081e71becb76a90ba6bd82ceb27ce2e0274ea36.tar.gz
UXP-a081e71becb76a90ba6bd82ceb27ce2e0274ea36.tar.lz
UXP-a081e71becb76a90ba6bd82ceb27ce2e0274ea36.tar.xz
UXP-a081e71becb76a90ba6bd82ceb27ce2e0274ea36.zip
Bug 1568095 - Make morkAtom::GetYarn() static.
Tag #1273
Diffstat (limited to 'db/mork/src')
-rw-r--r--db/mork/src/morkAtom.cpp29
-rw-r--r--db/mork/src/morkAtom.h2
-rw-r--r--db/mork/src/morkCell.cpp2
-rw-r--r--db/mork/src/morkCellObject.cpp2
-rw-r--r--db/mork/src/morkRow.cpp42
-rw-r--r--db/mork/src/morkRowObject.cpp3
-rw-r--r--db/mork/src/morkStore.cpp8
7 files changed, 44 insertions, 44 deletions
diff --git a/db/mork/src/morkAtom.cpp b/db/mork/src/morkAtom.cpp
index 0b73f97fa..b0621c3e9 100644
--- a/db/mork/src/morkAtom.cpp
+++ b/db/mork/src/morkAtom.cpp
@@ -29,40 +29,35 @@
//3456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789
-mork_bool
-morkAtom::GetYarn(mdbYarn* outYarn) const
+/* static */
+mork_bool morkAtom::GetYarn(const morkAtom* atom, mdbYarn* outYarn)
{
const void* source = 0;
mdb_fill fill = 0;
mdb_cscode form = 0;
outYarn->mYarn_More = 0;
- if ( this->IsWeeBook() )
- {
- morkWeeBookAtom* weeBook = (morkWeeBookAtom*) this;
+ if (atom) {
+ if (atom->IsWeeBook()) {
+ morkWeeBookAtom* weeBook = (morkWeeBookAtom*)atom;
source = weeBook->mWeeBookAtom_Body;
fill = weeBook->mAtom_Size;
- }
- else if ( this->IsBigBook() )
- {
- morkBigBookAtom* bigBook = (morkBigBookAtom*) this;
+ } else if (atom->IsBigBook()) {
+ morkBigBookAtom* bigBook = (morkBigBookAtom*)atom;
source = bigBook->mBigBookAtom_Body;
fill = bigBook->mBigBookAtom_Size;
form = bigBook->mBigBookAtom_Form;
- }
- else if ( this->IsWeeAnon() )
- {
- morkWeeAnonAtom* weeAnon = (morkWeeAnonAtom*) this;
+ } else if (atom->IsWeeAnon()) {
+ morkWeeAnonAtom* weeAnon = (morkWeeAnonAtom*)atom;
source = weeAnon->mWeeAnonAtom_Body;
fill = weeAnon->mAtom_Size;
- }
- else if ( this->IsBigAnon() )
- {
- morkBigAnonAtom* bigAnon = (morkBigAnonAtom*) this;
+ } else if (atom->IsBigAnon()) {
+ morkBigAnonAtom* bigAnon = (morkBigAnonAtom*)atom;
source = bigAnon->mBigAnonAtom_Body;
fill = bigAnon->mBigAnonAtom_Size;
form = bigAnon->mBigAnonAtom_Form;
}
+ }
if ( source && fill ) // have an atom with nonempty content?
{
diff --git a/db/mork/src/morkAtom.h b/db/mork/src/morkAtom.h
index fe229e4c6..1afe21cd8 100644
--- a/db/mork/src/morkAtom.h
+++ b/db/mork/src/morkAtom.h
@@ -89,7 +89,7 @@ public: // errors
public: // yarns
static mork_bool AliasYarn(const morkAtom* atom, mdbYarn* outYarn);
- mork_bool GetYarn(mdbYarn* outYarn) const;
+ static mork_bool GetYarn(const morkAtom* atom, mdbYarn* outYarn);
private: // copying is not allowed
morkAtom(const morkAtom& other);
diff --git a/db/mork/src/morkCell.cpp b/db/mork/src/morkCell.cpp
index c5844dd1a..80f9e04d0 100644
--- a/db/mork/src/morkCell.cpp
+++ b/db/mork/src/morkCell.cpp
@@ -45,7 +45,7 @@ void
morkCell::GetYarn(morkEnv* ev, mdbYarn* outYarn) const
{
MORK_USED_1(ev);
- mCell_Atom->GetYarn(outYarn);
+ morkAtom::GetYarn(mCell_Atom, outYarn);
}
void
diff --git a/db/mork/src/morkCellObject.cpp b/db/mork/src/morkCellObject.cpp
index 5310df07d..210b6d6e2 100644
--- a/db/mork/src/morkCellObject.cpp
+++ b/db/mork/src/morkCellObject.cpp
@@ -332,7 +332,7 @@ NS_IMETHODIMP morkCellObject::GetYarn(nsIMdbEnv* mev,
if ( ev )
{
morkAtom* atom = cell->GetAtom();
- atom->GetYarn(outYarn);
+ morkAtom::GetYarn(atom, outYarn);
outErr = ev->AsErr();
}
diff --git a/db/mork/src/morkRow.cpp b/db/mork/src/morkRow.cpp
index ede1bf646..e68148d06 100644
--- a/db/mork/src/morkRow.cpp
+++ b/db/mork/src/morkRow.cpp
@@ -447,17 +447,21 @@ void morkRow::SeekColumn(morkEnv* ev, mdb_pos inPos,
if ( cells && inPos < mRow_Length && inPos >= 0 )
{
morkCell* c = cells + inPos;
- if ( outColumn )
- *outColumn = c->GetColumn();
- if ( outYarn )
- c->mCell_Atom->GetYarn(outYarn); // nil atom works okay here
+ if ( outColumn ) {
+ *outColumn = c->GetColumn();
+ }
+ if ( outYarn ) {
+ morkAtom::GetYarn(c->mCell_Atom, outYarn);
+ }
}
else
{
- if ( outColumn )
- *outColumn = 0;
- if ( outYarn )
- ((morkAtom*) 0)->GetYarn(outYarn); // yes this will work
+ if ( outColumn ) {
+ *outColumn = 0;
+ }
+ if ( outYarn ) {
+ morkAtom::GetYarn((morkAtom*)0, outYarn);
+ }
}
}
@@ -467,28 +471,30 @@ morkRow::NextColumn(morkEnv* ev, mdb_column* ioColumn, mdbYarn* outYarn)
morkCell* cells = mRow_Cells;
if ( cells )
{
- mork_column last = 0;
- mork_column inCol = *ioColumn;
+ mork_column last = 0;
+ mork_column inCol = *ioColumn;
morkCell* end = cells + mRow_Length;
while ( cells < end )
{
if ( inCol == last ) // found column?
{
- if ( outYarn )
- cells->mCell_Atom->GetYarn(outYarn); // nil atom works okay here
+ if ( outYarn ) {
+ if (outYarn) {
+ morkAtom::GetYarn(cells->mCell_Atom, outYarn);
+ }
*ioColumn = cells->GetColumn();
return; // stop, we are done
- }
- else
- {
+ }
+ } else {
last = cells->GetColumn();
++cells;
}
}
}
- *ioColumn = 0;
- if ( outYarn )
- ((morkAtom*) 0)->GetYarn(outYarn); // yes this will work
+ *ioColumn = 0;
+ if ( outYarn ) {
+ morkAtom::GetYarn((morkAtom*)0, outYarn);
+ }
}
morkCell*
diff --git a/db/mork/src/morkRowObject.cpp b/db/mork/src/morkRowObject.cpp
index 884b5be4c..33909c36d 100644
--- a/db/mork/src/morkRowObject.cpp
+++ b/db/mork/src/morkRowObject.cpp
@@ -467,8 +467,7 @@ morkRowObject::GetCellYarn(
if ( mRowObject_Store && mRowObject_Row)
{
morkAtom* atom = mRowObject_Row->GetColumnAtom(ev, inColumn);
- atom->GetYarn(outYarn);
- // note nil atom works and sets yarn correctly
+ morkAtom::GetYarn(atom, outYarn);
}
outErr = ev->AsErr();
diff --git a/db/mork/src/morkStore.cpp b/db/mork/src/morkStore.cpp
index 4f689d410..d6e70becd 100644
--- a/db/mork/src/morkStore.cpp
+++ b/db/mork/src/morkStore.cpp
@@ -775,7 +775,7 @@ morkStore::OidToYarn(morkEnv* ev, const mdbOid& inOid, mdbYarn* outYarn)
morkAtomAidMap* map = &atomSpace->mAtomSpace_AtomAids;
atom = map->GetAid(ev, (mork_aid) inOid.mOid_Id);
}
- atom->GetYarn(outYarn); // note this is safe even when atom==nil
+ morkAtom::GetYarn(atom, outYarn);
return ev->Good();
}
@@ -823,10 +823,10 @@ morkStore::TokenToString(morkEnv* ev, mdb_token inToken, mdbYarn* outTokenName)
{
morkBookAtom* atom = 0;
morkAtomSpace* space = mStore_GroundColumnSpace;
- if ( space )
+ if ( space ) {
atom = space->mAtomSpace_AtomAids.GetAid(ev, (mork_aid) inToken);
-
- atom->GetYarn(outTokenName); // note this is safe even when atom==nil
+ }
+ morkAtom::GetYarn(atom, outTokenName);
}
else // token is an "immediate" single byte string representation?
this->SmallTokenToOneByteYarn(ev, inToken, outTokenName);