Re: [OPEN-ILS-DEV] SPAM: PATCH: storing numbers as strings in jsonObjects

2008-01-07 Thread Bill Erickson

Mike Rylander wrote:

On Dec 22, 2007 11:44 PM, Scott McKellar [EMAIL PROTECTED] wrote:
  

These patches are the culmination of several postings on this subject.
The overall effect is to store numbers in jsonObjects as strings,
rather than as doubles, in order to avoid needless loss of precision
in translating back and forth between text and floating point
representations.



This compiles fine in a full environment, and it's the direction we
need to go, so these are applied.  We will keep a close eye on things,
but I suspect any issues will show up right away, and should be easy
to spot with high enough logging.

Thanks for all the work on this, Scott.  It's been nagging me, and I
think this will be a great benefit in the long run.
  


I'd just like to echo Mike's thanks.  We really appreciate the hard work 
and good code, Scott.


-bill


--
Bill Erickson
| VP, Software Development  Integration
| Equinox Software, Inc. / The Evergreen Experts
| phone: 877-OPEN-ILS (673-6457)
| email: [EMAIL PROTECTED]
| web: http://esilibrary.com



[OPEN-ILS-DEV] PATCH: oils_cstore.c (memory leaks)

2008-01-07 Thread Scott McKellar
This patch plugs a variety of miscellaneous memory leaks, most of
them in connection with early exits.  I won't list them here
because you can readily verify them yourself (and should).

Scott McKellar
http://home.swbell.net/mck9/ct/

Developer's Certificate of Origin 1.1 By making a contribution to
this project, I certify that:

(a) The contribution was created in whole or in part by me and I
have the right to submit it under the open source license indicated
in the file; or

(b) The contribution is based upon previous work that, to the best
of my knowledge, is covered under an appropriate open source license
and I have the right under that license to submit that work with
modifications, whether created in whole or in part by me, under the
same open source license (unless I am permitted to submit under a
different license), as indicated in the file; or

(c) The contribution was provided directly to me by some other person
who certified (a), (b) or (c) and I have not modified it; and

(d) In the case of each of (a), (b), or (c), I understand and agree
that this project and the contribution are public and that a record
of the contribution (including all personal information I submit
with it, including my sign-off) is maintained indefinitely and may
be redistributed consistent with this project or the open source
license indicated in the file.*** ./trunk/Open-ILS/src/c-apps/oils_cstore.c	2008-01-06 21:05:21.0 -0600
--- ./trunk-mod/Open-ILS/src/c-apps/oils_cstore.c	2008-01-07 20:37:14.0 -0600
***
*** 234,239 
--- 234,240 
  		}
  	}
  
+ 	osrfStringArrayFree( global_methods );
  	return 0;
  }
  
***
*** 1180,1187 
  }
  
  static char* searchFieldTransformPredicate (const char* class, osrfHash* field, jsonObjectNode* node) {
- 	growing_buffer* sql_buf = buffer_init(32);
- 	
  	char* field_transform = searchFieldTransform( class, field, node-item );
  	char* value = NULL;
  
--- 1181,1186 
***
*** 1199,1209 
--- 1198,1211 
  			if ( !dbi_conn_quote_string(dbhandle, value) ) {
  osrfLogError(OSRF_LOG_MARK, %s: Error quoting key string [%s], MODULENAME, value);
  free(value);
+ free(field_transform);
  return NULL;
  			}
  		}
  	}
  
+ 	growing_buffer* sql_buf = buffer_init(32);
+ 	
  	buffer_fadd(
  		sql_buf,
  		%s %s %s,
***
*** 1212,1217 
--- 1214,1220 
  		value
  	);
  
+ 	free(value);
  	free(field_transform);
  
  	return buffer_release(sql_buf);
***
*** 1418,1423 
--- 1421,1427 
  	leftclass
  );
  buffer_free(join_buf);
+ free(table);
  return NULL;
  			}
  			fkey = strdup( fkey );
***
*** 1434,1439 
--- 1438,1444 
  	class
  );
  buffer_free(join_buf);
+ free(table);
  return NULL;
  			}
  			field = strdup( field );
***
*** 1480,1485 
--- 1485,1491 
  	class
  );
  buffer_free(join_buf);
+ free(table);
  return NULL;
  			}
  
***
*** 1703,1710 
  	}
  
  	// punt if we don't know about the core class
! 	if (!(core_meta = osrfHashGet( oilsIDL(), core_class )))
  		return NULL;
  
  	// if the select list is empty, or the core class field list is '*',
  	// build the default select list ...
--- 1709,1718 
  	}
  
  	// punt if we don't know about the core class
! 	if (!(core_meta = osrfHashGet( oilsIDL(), core_class ))) {
! 		free(core_class);
  		return NULL;
+ 	}
  
  	// if the select list is empty, or the core class field list is '*',
  	// build the default select list ...
***
*** 2542,2551 
--- 2550,2561 
  		*err = -1;
  		free(sql);
  		jsonObjectFree(res_list);
+ 		osrfHashFree(dedup);
  		return jsonNULL;
  
  	}
  
+ 	osrfHashFree(dedup);
  	free(sql);
  
  	if (res_list-size  order_hash) {