The branch, master, has been updated.

- Log -----------------------------------------------------------------

commit 6c983d6cd16ad09f7610d13a9e53c721f930e02a
Author: Richard Heck <[email protected]>
Date:   Sat Apr 6 12:34:26 2013 -0400

    Simplify code a bit: If we only accept CITE_CODE, there is no need
    to pass it.

diff --git a/src/Buffer.cpp b/src/Buffer.cpp
index 7f3773c..5333642 100644
--- a/src/Buffer.cpp
+++ b/src/Buffer.cpp
@@ -3359,12 +3359,9 @@ void Buffer::clearReferenceCache() const
 }
 
 
-void Buffer::changeRefsIfUnique(docstring const & from, docstring const & to,
-       InsetCode code)
+void Buffer::changeRefsIfUnique(docstring const & from, docstring const & to)
 {
        //FIXME: This does not work for child documents yet.
-       LASSERT(code == CITE_CODE, /**/);
-
        reloadBibInfoCache();
 
        // Check if the label 'from' appears more than once
@@ -3382,14 +3379,12 @@ void Buffer::changeRefsIfUnique(docstring const & from, 
docstring const & to,
 
        string const paramName = "key";
        for (InsetIterator it = inset_iterator_begin(inset()); it; ++it) {
-               if (it->lyxCode() == code) {
-                       InsetCommand * inset = it->asInsetCommand();
-                       if (!inset)
-                               continue;
-                       docstring const oldValue = inset->getParam(paramName);
-                       if (oldValue == from)
-                               inset->setParam(paramName, to);
-               }
+               if (it->lyxCode() != CITE_CODE) 
+                       continue;
+               InsetCommand * inset = it->asInsetCommand();
+               docstring const oldValue = inset->getParam(paramName);
+               if (oldValue == from)
+                       inset->setParam(paramName, to);
        }
 }
 
diff --git a/src/Buffer.h b/src/Buffer.h
index a1afc8b..4e55654 100644
--- a/src/Buffer.h
+++ b/src/Buffer.h
@@ -591,8 +591,7 @@ public:
 
        /// Replace the inset contents for insets which InsetCode is equal
        /// to the passed \p inset_code.
-       void changeRefsIfUnique(docstring const & from, docstring const & to,
-               InsetCode code);
+       void changeRefsIfUnique(docstring const & from, docstring const & to);
 
        /// get source code (latex/docbook) for some paragraphs, or all 
paragraphs
        /// including preamble
diff --git a/src/insets/InsetBibitem.cpp b/src/insets/InsetBibitem.cpp
index d8a0666..5241859 100644
--- a/src/insets/InsetBibitem.cpp
+++ b/src/insets/InsetBibitem.cpp
@@ -177,8 +177,7 @@ void InsetBibitem::doDispatch(Cursor & cur, FuncRequest & 
cmd)
                setParam("label", p["label"]);
                if (p["key"] != old_key) {
                        updateCommand(p["key"]);
-                       cur.bv().buffer().changeRefsIfUnique(old_key,
-                               params()["key"], CITE_CODE);
+                       cur.bv().buffer().changeRefsIfUnique(old_key, 
params()["key"]);
                        cur.forceBufferUpdate();
                        buffer().invalidateBibinfoCache();
                }

-----------------------------------------------------------------------

Summary of changes:
 src/Buffer.cpp              |   19 +++++++------------
 src/Buffer.h                |    3 +--
 src/insets/InsetBibitem.cpp |    3 +--
 3 files changed, 9 insertions(+), 16 deletions(-)


hooks/post-receive
-- 
The LyX Source Repository

Reply via email to