qpid_messaging 0.34.1 → 1.35.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/ext/cqpid/cqpid.cpp +53 -79
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f740c8fe9a9a150a6d27626c2efe101d620c5bb5
4
- data.tar.gz: b280c59daeda5e2ff7938ec68762ec0aeb1d763d
3
+ metadata.gz: 27e25e910934b6d144367158db2263b4e22165ce
4
+ data.tar.gz: 82f1ae4b8a1ffefa8b16532d942e2e1d9c9a7b95
5
5
  SHA512:
6
- metadata.gz: 8d3f3e777650c5fa94af770376a760d1cac8d7527d07bacdb7eb3c05fc9dad2928d3fae6485c577e2121f174c5698700f04ad59fc90a33d6cdd5e5b39d6e0cda
7
- data.tar.gz: e0b2e01875c128043cad8f6f41cd6aa5f08f445bf6546acf774d818f979dd55144df6e659b1e0c9a355ec906c2dee94fddacf3141b9d59a2276b2e8010eb359e
6
+ metadata.gz: 550fe9e5d6ba812d3170a2fb99260b940e8b6d396481b2d7e00f1094e6d65d77c26b3e8048e46b1d9ba5a7baad1912ed4a67fad3221b0e3d1f0727202992be73
7
+ data.tar.gz: a5d435eb9c8cb87507dbc0f67ade7109f75e7d6e6fd78ce277f80537072c5998e751bdcd3ad28d9d1aea2b45a539d4613b3c13634d044d9c225ec9a7d1ba509e
@@ -1194,6 +1194,11 @@ void Ruby_Format_OverloadedError(
1194
1194
  extern "C" {
1195
1195
  #endif
1196
1196
 
1197
+ #if !defined(ST_DATA_T_DEFINED)
1198
+ /* Needs to be explicitly included for Ruby 1.8 and earlier */
1199
+ #include <st.h>
1200
+ #endif
1201
+
1197
1202
  /* Ruby 1.8 actually assumes the first case. */
1198
1203
  #if SIZEOF_VOIDP == SIZEOF_LONG
1199
1204
  # define SWIG2NUM(v) LONG2NUM((unsigned long)v)
@@ -1205,19 +1210,19 @@ extern "C" {
1205
1210
  # error sizeof(void*) is not the same as long or long long
1206
1211
  #endif
1207
1212
 
1208
-
1209
- /* Global Ruby hash table to store Trackings from C/C++
1213
+ /* Global hash table to store Trackings from C/C++
1210
1214
  structs to Ruby Objects.
1211
1215
  */
1212
- static VALUE swig_ruby_trackings = Qnil;
1216
+ static st_table* swig_ruby_trackings = NULL;
1217
+
1218
+ static VALUE swig_ruby_trackings_count(ANYARGS) {
1219
+ return SWIG2NUM(swig_ruby_trackings->num_entries);
1220
+ }
1213
1221
 
1214
- /* Global variable that stores a reference to the ruby
1215
- hash table delete function. */
1216
- static ID swig_ruby_hash_delete;
1217
1222
 
1218
- /* Setup a Ruby hash table to store Trackings */
1223
+ /* Setup a hash table to store Trackings */
1219
1224
  SWIGRUNTIME void SWIG_RubyInitializeTrackings(void) {
1220
- /* Create a ruby hash table to store Trackings from C++
1225
+ /* Create a hash table to store Trackings from C++
1221
1226
  objects to Ruby objects. */
1222
1227
 
1223
1228
  /* Try to see if some other .so has already created a
@@ -1226,88 +1231,46 @@ SWIGRUNTIME void SWIG_RubyInitializeTrackings(void) {
1226
1231
  This is done to allow multiple DSOs to share the same
1227
1232
  tracking table.
1228
1233
  */
1229
- ID trackings_id = rb_intern( "@__trackings__" );
1234
+ VALUE trackings_value = Qnil;
1235
+ /* change the variable name so that we can mix modules
1236
+ compiled with older SWIG's - this used to be called "@__trackings__" */
1237
+ ID trackings_id = rb_intern( "@__safetrackings__" );
1230
1238
  VALUE verbose = rb_gv_get("VERBOSE");
1231
1239
  rb_gv_set("VERBOSE", Qfalse);
1232
- swig_ruby_trackings = rb_ivar_get( _mSWIG, trackings_id );
1240
+ trackings_value = rb_ivar_get( _mSWIG, trackings_id );
1233
1241
  rb_gv_set("VERBOSE", verbose);
1234
1242
 
1235
- /* No, it hasn't. Create one ourselves */
1236
- if ( swig_ruby_trackings == Qnil )
1237
- {
1238
- swig_ruby_trackings = rb_hash_new();
1239
- rb_ivar_set( _mSWIG, trackings_id, swig_ruby_trackings );
1240
- }
1241
-
1242
- /* Now store a reference to the hash table delete function
1243
- so that we only have to look it up once.*/
1244
- swig_ruby_hash_delete = rb_intern("delete");
1245
- }
1246
-
1247
- /* Get a Ruby number to reference a pointer */
1248
- SWIGRUNTIME VALUE SWIG_RubyPtrToReference(void* ptr) {
1249
- /* We cast the pointer to an unsigned long
1250
- and then store a reference to it using
1251
- a Ruby number object. */
1252
-
1253
- /* Convert the pointer to a Ruby number */
1254
- return SWIG2NUM(ptr);
1255
- }
1256
-
1257
- /* Get a Ruby number to reference an object */
1258
- SWIGRUNTIME VALUE SWIG_RubyObjectToReference(VALUE object) {
1259
- /* We cast the object to an unsigned long
1260
- and then store a reference to it using
1261
- a Ruby number object. */
1262
-
1263
- /* Convert the Object to a Ruby number */
1264
- return SWIG2NUM(object);
1265
- }
1266
-
1267
- /* Get a Ruby object from a previously stored reference */
1268
- SWIGRUNTIME VALUE SWIG_RubyReferenceToObject(VALUE reference) {
1269
- /* The provided Ruby number object is a reference
1270
- to the Ruby object we want.*/
1243
+ /* The trick here is that we have to store the hash table
1244
+ pointer in a Ruby variable. We do not want Ruby's GC to
1245
+ treat this pointer as a Ruby object, so we convert it to
1246
+ a Ruby numeric value. */
1247
+ if (trackings_value == Qnil) {
1248
+ /* No, it hasn't. Create one ourselves */
1249
+ swig_ruby_trackings = st_init_numtable();
1250
+ rb_ivar_set( _mSWIG, trackings_id, SWIG2NUM(swig_ruby_trackings) );
1251
+ } else {
1252
+ swig_ruby_trackings = (st_table*)NUM2SWIG(trackings_value);
1253
+ }
1271
1254
 
1272
- /* Convert the Ruby number to a Ruby object */
1273
- return NUM2SWIG(reference);
1255
+ rb_define_virtual_variable("SWIG_TRACKINGS_COUNT", swig_ruby_trackings_count, NULL);
1274
1256
  }
1275
1257
 
1276
1258
  /* Add a Tracking from a C/C++ struct to a Ruby object */
1277
1259
  SWIGRUNTIME void SWIG_RubyAddTracking(void* ptr, VALUE object) {
1278
- /* In a Ruby hash table we store the pointer and
1279
- the associated Ruby object. The trick here is
1280
- that we cannot store the Ruby object directly - if
1281
- we do then it cannot be garbage collected. So
1282
- instead we typecast it as a unsigned long and
1283
- convert it to a Ruby number object.*/
1284
-
1285
- /* Get a reference to the pointer as a Ruby number */
1286
- VALUE key = SWIG_RubyPtrToReference(ptr);
1287
-
1288
- /* Get a reference to the Ruby object as a Ruby number */
1289
- VALUE value = SWIG_RubyObjectToReference(object);
1290
-
1291
1260
  /* Store the mapping to the global hash table. */
1292
- rb_hash_aset(swig_ruby_trackings, key, value);
1261
+ st_insert(swig_ruby_trackings, (st_data_t)ptr, object);
1293
1262
  }
1294
1263
 
1295
1264
  /* Get the Ruby object that owns the specified C/C++ struct */
1296
1265
  SWIGRUNTIME VALUE SWIG_RubyInstanceFor(void* ptr) {
1297
- /* Get a reference to the pointer as a Ruby number */
1298
- VALUE key = SWIG_RubyPtrToReference(ptr);
1299
-
1300
1266
  /* Now lookup the value stored in the global hash table */
1301
- VALUE value = rb_hash_aref(swig_ruby_trackings, key);
1302
-
1303
- if (value == Qnil) {
1304
- /* No object exists - return nil. */
1267
+ VALUE value;
1268
+
1269
+ if (st_lookup(swig_ruby_trackings, (st_data_t)ptr, &value)) {
1270
+ return value;
1271
+ } else {
1305
1272
  return Qnil;
1306
1273
  }
1307
- else {
1308
- /* Convert this value to Ruby object */
1309
- return SWIG_RubyReferenceToObject(value);
1310
- }
1311
1274
  }
1312
1275
 
1313
1276
  /* Remove a Tracking from a C/C++ struct to a Ruby object. It
@@ -1315,12 +1278,8 @@ SWIGRUNTIME VALUE SWIG_RubyInstanceFor(void* ptr) {
1315
1278
  since the same memory address may be reused later to create
1316
1279
  a new object. */
1317
1280
  SWIGRUNTIME void SWIG_RubyRemoveTracking(void* ptr) {
1318
- /* Get a reference to the pointer as a Ruby number */
1319
- VALUE key = SWIG_RubyPtrToReference(ptr);
1320
-
1321
- /* Delete the object from the hash table by calling Ruby's
1322
- do this we need to call the Hash.delete method.*/
1323
- rb_funcall(swig_ruby_trackings, swig_ruby_hash_delete, 1, key);
1281
+ /* Delete the object from the hash table */
1282
+ st_delete(swig_ruby_trackings, (st_data_t *)&ptr, NULL);
1324
1283
  }
1325
1284
 
1326
1285
  /* This is a helper method that unlinks a Ruby object from its
@@ -1330,10 +1289,25 @@ SWIGRUNTIME void SWIG_RubyUnlinkObjects(void* ptr) {
1330
1289
  VALUE object = SWIG_RubyInstanceFor(ptr);
1331
1290
 
1332
1291
  if (object != Qnil) {
1292
+ if (TYPE(object) != T_DATA)
1293
+ abort();
1333
1294
  DATA_PTR(object) = 0;
1334
1295
  }
1335
1296
  }
1336
1297
 
1298
+ /* This is a helper method that iterates over all the trackings
1299
+ passing the C++ object pointer and its related Ruby object
1300
+ to the passed callback function. */
1301
+
1302
+ /* Proxy method to abstract the internal trackings datatype */
1303
+ static int swig_ruby_internal_iterate_callback(void* ptr, VALUE obj, void(*meth)(void* ptr, VALUE obj)) {
1304
+ (*meth)(ptr, obj);
1305
+ return ST_CONTINUE;
1306
+ }
1307
+
1308
+ SWIGRUNTIME void SWIG_RubyIterateTrackings( void(*meth)(void* ptr, VALUE obj) ) {
1309
+ st_foreach(swig_ruby_trackings, (int (*)(ANYARGS))&swig_ruby_internal_iterate_callback, (st_data_t)meth);
1310
+ }
1337
1311
 
1338
1312
  #ifdef __cplusplus
1339
1313
  }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: qpid_messaging
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.34.1
4
+ version: 1.35.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Apache Qpid Project
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-09-10 00:00:00.000000000 Z
11
+ date: 2016-09-09 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Qpid is an enterprise messaging framework.
14
14
  email: dev@qpid.apache.org