You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@thrift.apache.org by dr...@apache.org on 2010/10/05 18:39:28 UTC
svn commit: r1004702 - in /incubator/thrift/trunk/compiler/cpp: Makefile.am
src/parse/parse.cc src/parse/t_type.h
Author: dreiss
Date: Tue Oct 5 16:39:27 2010
New Revision: 1004702
URL: http://svn.apache.org/viewvc?rev=1004702&view=rev
Log:
compiler: Move t_type::generate_fingerprint to a .cc file
Forcing all of the functions under src/parse to be defined in header
files is silly and sometimes painful. Createa a "parse.cc" file for
functions that don't belong in header files. To start, move
generate_fingerprint there, because it requires including md5.h.
Added:
incubator/thrift/trunk/compiler/cpp/src/parse/parse.cc
Modified:
incubator/thrift/trunk/compiler/cpp/Makefile.am
incubator/thrift/trunk/compiler/cpp/src/parse/t_type.h
Modified: incubator/thrift/trunk/compiler/cpp/Makefile.am
URL: http://svn.apache.org/viewvc/incubator/thrift/trunk/compiler/cpp/Makefile.am?rev=1004702&r1=1004701&r2=1004702&view=diff
==============================================================================
--- incubator/thrift/trunk/compiler/cpp/Makefile.am (original)
+++ incubator/thrift/trunk/compiler/cpp/Makefile.am Tue Oct 5 16:39:27 2010
@@ -56,6 +56,7 @@ thrift_SOURCES = src/thrifty.yy \
src/parse/t_scope.h \
src/parse/t_const.h \
src/parse/t_const_value.h \
+ src/parse/parse.cc \
src/generate/t_generator.h \
src/generate/t_oop_generator.h
Added: incubator/thrift/trunk/compiler/cpp/src/parse/parse.cc
URL: http://svn.apache.org/viewvc/incubator/thrift/trunk/compiler/cpp/src/parse/parse.cc?rev=1004702&view=auto
==============================================================================
--- incubator/thrift/trunk/compiler/cpp/src/parse/parse.cc (added)
+++ incubator/thrift/trunk/compiler/cpp/src/parse/parse.cc Tue Oct 5 16:39:27 2010
@@ -0,0 +1,11 @@
+#include "t_type.h"
+
+#include "md5.h"
+
+void t_type::generate_fingerprint() {
+ std::string material = get_fingerprint_material();
+ md5_state_t ctx;
+ md5_init(&ctx);
+ md5_append(&ctx, (md5_byte_t*)(material.data()), (int)material.size());
+ md5_finish(&ctx, (md5_byte_t*)fingerprint_);
+}
Modified: incubator/thrift/trunk/compiler/cpp/src/parse/t_type.h
URL: http://svn.apache.org/viewvc/incubator/thrift/trunk/compiler/cpp/src/parse/t_type.h?rev=1004702&r1=1004701&r2=1004702&view=diff
==============================================================================
--- incubator/thrift/trunk/compiler/cpp/src/parse/t_type.h (original)
+++ incubator/thrift/trunk/compiler/cpp/src/parse/t_type.h Tue Oct 5 16:39:27 2010
@@ -26,9 +26,6 @@
#include <stdint.h>
#include "t_doc.h"
-// What's worse? This, or making a src/parse/non_inlined.cc?
-#include "md5.h"
-
class t_program;
/**
@@ -82,13 +79,7 @@ class t_type : public t_doc {
static const int fingerprint_len = 16;
// Call this before trying get_*_fingerprint().
- virtual void generate_fingerprint() {
- std::string material = get_fingerprint_material();
- md5_state_t ctx;
- md5_init(&ctx);
- md5_append(&ctx, (md5_byte_t*)(material.data()), (int)material.size());
- md5_finish(&ctx, (md5_byte_t*)fingerprint_);
- }
+ virtual void generate_fingerprint();
bool has_fingerprint() const {
for (int i = 0; i < fingerprint_len; i++) {