<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -3297,38 +3297,6 @@ fail:
 
 
 SWIGINTERN VALUE
-_wrap_svm_get_obj(int argc, VALUE *argv, VALUE self) {
-  svm_model *arg1 = (svm_model *) 0 ;
-  int arg2 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  int val2 ;
-  int ecode2 = 0 ;
-  double result;
-  VALUE vresult = Qnil;
-  
-  if ((argc &lt; 2) || (argc &gt; 2)) {
-    rb_raise(rb_eArgError, &quot;wrong # of arguments(%d for 2)&quot;,argc); SWIG_fail;
-  }
-  res1 = SWIG_ConvertPtr(argv[0], &amp;argp1,SWIGTYPE_p_svm_model, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( &quot;&quot;, &quot;svm_model const *&quot;,&quot;svm_get_obj&quot;, 1, argv[0] )); 
-  }
-  arg1 = reinterpret_cast&lt; svm_model * &gt;(argp1);
-  ecode2 = SWIG_AsVal_int(argv[1], &amp;val2);
-  if (!SWIG_IsOK(ecode2)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( &quot;&quot;, &quot;int&quot;,&quot;svm_get_obj&quot;, 2, argv[1] ));
-  } 
-  arg2 = static_cast&lt; int &gt;(val2);
-  result = (double)svm_get_obj((svm_model const *)arg1,arg2);
-  vresult = SWIG_From_double(static_cast&lt; double &gt;(result));
-  return vresult;
-fail:
-  return Qnil;
-}
-
-
-SWIGINTERN VALUE
 _wrap_svm_get_svm_type(int argc, VALUE *argv, VALUE self) {
   svm_model *arg1 = (svm_model *) 0 ;
   void *argp1 = 0 ;
@@ -3616,112 +3584,6 @@ fail:
 
 
 SWIGINTERN VALUE
-_wrap_svm_get_model_rho(int argc, VALUE *argv, VALUE self) {
-  svm_model *arg1 = (svm_model *) 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  double result;
-  VALUE vresult = Qnil;
-  
-  if ((argc &lt; 1) || (argc &gt; 1)) {
-    rb_raise(rb_eArgError, &quot;wrong # of arguments(%d for 1)&quot;,argc); SWIG_fail;
-  }
-  res1 = SWIG_ConvertPtr(argv[0], &amp;argp1,SWIGTYPE_p_svm_model, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( &quot;&quot;, &quot;svm_model *&quot;,&quot;svm_get_model_rho&quot;, 1, argv[0] )); 
-  }
-  arg1 = reinterpret_cast&lt; svm_model * &gt;(argp1);
-  result = (double)svm_get_model_rho(arg1);
-  vresult = SWIG_From_double(static_cast&lt; double &gt;(result));
-  return vresult;
-fail:
-  return Qnil;
-}
-
-
-SWIGINTERN VALUE
-_wrap_svm_get_model_num_coefs(int argc, VALUE *argv, VALUE self) {
-  svm_model *arg1 = (svm_model *) 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  int result;
-  VALUE vresult = Qnil;
-  
-  if ((argc &lt; 1) || (argc &gt; 1)) {
-    rb_raise(rb_eArgError, &quot;wrong # of arguments(%d for 1)&quot;,argc); SWIG_fail;
-  }
-  res1 = SWIG_ConvertPtr(argv[0], &amp;argp1,SWIGTYPE_p_svm_model, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( &quot;&quot;, &quot;svm_model *&quot;,&quot;svm_get_model_num_coefs&quot;, 1, argv[0] )); 
-  }
-  arg1 = reinterpret_cast&lt; svm_model * &gt;(argp1);
-  result = (int)svm_get_model_num_coefs(arg1);
-  vresult = SWIG_From_int(static_cast&lt; int &gt;(result));
-  return vresult;
-fail:
-  return Qnil;
-}
-
-
-SWIGINTERN VALUE
-_wrap_svm_get_model_coefs(int argc, VALUE *argv, VALUE self) {
-  svm_model *arg1 = (svm_model *) 0 ;
-  double *arg2 = (double *) 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  void *argp2 = 0 ;
-  int res2 = 0 ;
-  
-  if ((argc &lt; 2) || (argc &gt; 2)) {
-    rb_raise(rb_eArgError, &quot;wrong # of arguments(%d for 2)&quot;,argc); SWIG_fail;
-  }
-  res1 = SWIG_ConvertPtr(argv[0], &amp;argp1,SWIGTYPE_p_svm_model, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( &quot;&quot;, &quot;svm_model *&quot;,&quot;svm_get_model_coefs&quot;, 1, argv[0] )); 
-  }
-  arg1 = reinterpret_cast&lt; svm_model * &gt;(argp1);
-  res2 = SWIG_ConvertPtr(argv[1], &amp;argp2,SWIGTYPE_p_double, 0 |  0 );
-  if (!SWIG_IsOK(res2)) {
-    SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( &quot;&quot;, &quot;double *&quot;,&quot;svm_get_model_coefs&quot;, 2, argv[1] )); 
-  }
-  arg2 = reinterpret_cast&lt; double * &gt;(argp2);
-  svm_get_model_coefs(arg1,arg2);
-  return Qnil;
-fail:
-  return Qnil;
-}
-
-
-SWIGINTERN VALUE
-_wrap_svm_get_model_perm(int argc, VALUE *argv, VALUE self) {
-  svm_model *arg1 = (svm_model *) 0 ;
-  int *arg2 = (int *) 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  void *argp2 = 0 ;
-  int res2 = 0 ;
-  
-  if ((argc &lt; 2) || (argc &gt; 2)) {
-    rb_raise(rb_eArgError, &quot;wrong # of arguments(%d for 2)&quot;,argc); SWIG_fail;
-  }
-  res1 = SWIG_ConvertPtr(argv[0], &amp;argp1,SWIGTYPE_p_svm_model, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( &quot;&quot;, &quot;svm_model *&quot;,&quot;svm_get_model_perm&quot;, 1, argv[0] )); 
-  }
-  arg1 = reinterpret_cast&lt; svm_model * &gt;(argp1);
-  res2 = SWIG_ConvertPtr(argv[1], &amp;argp2,SWIGTYPE_p_int, 0 |  0 );
-  if (!SWIG_IsOK(res2)) {
-    SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( &quot;&quot;, &quot;int *&quot;,&quot;svm_get_model_perm&quot;, 2, argv[1] )); 
-  }
-  arg2 = reinterpret_cast&lt; int * &gt;(argp2);
-  svm_get_model_perm(arg1,arg2);
-  return Qnil;
-fail:
-  return Qnil;
-}
-
-
-SWIGINTERN VALUE
 _wrap_new_int(int argc, VALUE *argv, VALUE self) {
   size_t arg1 ;
   size_t val1 ;
@@ -4513,7 +4375,6 @@ SWIGEXPORT void Init_libsvm(void) {
   rb_define_module_function(mLibsvm, &quot;svm_cross_validation&quot;, VALUEFUNC(_wrap_svm_cross_validation), -1);
   rb_define_module_function(mLibsvm, &quot;svm_save_model&quot;, VALUEFUNC(_wrap_svm_save_model), -1);
   rb_define_module_function(mLibsvm, &quot;svm_load_model&quot;, VALUEFUNC(_wrap_svm_load_model), -1);
-  rb_define_module_function(mLibsvm, &quot;svm_get_obj&quot;, VALUEFUNC(_wrap_svm_get_obj), -1);
   rb_define_module_function(mLibsvm, &quot;svm_get_svm_type&quot;, VALUEFUNC(_wrap_svm_get_svm_type), -1);
   rb_define_module_function(mLibsvm, &quot;svm_get_nr_class&quot;, VALUEFUNC(_wrap_svm_get_nr_class), -1);
   rb_define_module_function(mLibsvm, &quot;svm_get_labels&quot;, VALUEFUNC(_wrap_svm_get_labels), -1);
@@ -4524,10 +4385,6 @@ SWIGEXPORT void Init_libsvm(void) {
   rb_define_module_function(mLibsvm, &quot;svm_destroy_model&quot;, VALUEFUNC(_wrap_svm_destroy_model), -1);
   rb_define_module_function(mLibsvm, &quot;svm_check_parameter&quot;, VALUEFUNC(_wrap_svm_check_parameter), -1);
   rb_define_module_function(mLibsvm, &quot;svm_check_probability_model&quot;, VALUEFUNC(_wrap_svm_check_probability_model), -1);
-  rb_define_module_function(mLibsvm, &quot;svm_get_model_rho&quot;, VALUEFUNC(_wrap_svm_get_model_rho), -1);
-  rb_define_module_function(mLibsvm, &quot;svm_get_model_num_coefs&quot;, VALUEFUNC(_wrap_svm_get_model_num_coefs), -1);
-  rb_define_module_function(mLibsvm, &quot;svm_get_model_coefs&quot;, VALUEFUNC(_wrap_svm_get_model_coefs), -1);
-  rb_define_module_function(mLibsvm, &quot;svm_get_model_perm&quot;, VALUEFUNC(_wrap_svm_get_model_perm), -1);
   rb_define_module_function(mLibsvm, &quot;new_int&quot;, VALUEFUNC(_wrap_new_int), -1);
   rb_define_module_function(mLibsvm, &quot;delete_int&quot;, VALUEFUNC(_wrap_delete_int), -1);
   rb_define_module_function(mLibsvm, &quot;int_getitem&quot;, VALUEFUNC(_wrap_int_getitem), -1);</diff>
      <filename>ext/libsvm_wrap.cxx</filename>
    </modified>
    <modified>
      <diff>@@ -6,6 +6,7 @@
 #include &lt;string.h&gt;
 #include &lt;stdarg.h&gt;
 #include &quot;svm.h&quot;
+int libsvm_version = LIBSVM_VERSION;
 typedef float Qfloat;
 typedef signed char schar;
 #ifndef min
@@ -22,36 +23,40 @@ template &lt;class S, class T&gt; inline void clone(T*&amp; dst, S* src, int n)
 }
 inline double powi(double base, int times)
 {
-        double tmp = base, ret = 1.0;
+	double tmp = base, ret = 1.0;
 
-        for(int t=times; t&gt;0; t/=2)
+	for(int t=times; t&gt;0; t/=2)
 	{
-                if(t%2==1) ret*=tmp;
-                tmp = tmp * tmp;
-        }
-        return ret;
+		if(t%2==1) ret*=tmp;
+		tmp = tmp * tmp;
+	}
+	return ret;
 }
 #define INF HUGE_VAL
 #define TAU 1e-12
 #define Malloc(type,n) (type *)malloc((n)*sizeof(type))
+
+static void print_string_stdout(const char *s)
+{
+	fputs(s,stdout);
+	fflush(stdout);
+}
+void (*svm_print_string) (const char *) = &amp;print_string_stdout;
 #if 1
 int info_on = 0;
 static void info(const char *fmt,...)
 {
+	char buf[BUFSIZ];
 	va_list ap;
   if (info_on==1) {
-  	va_start(ap,fmt);
-	  vprintf(fmt,ap);
-  	va_end(ap);
+	va_start(ap,fmt);
+	vsprintf(buf,fmt,ap);
+	va_end(ap);
+	(*svm_print_string)(buf);
   }
 }
-static void info_flush()
-{
-	if (info_on==1) fflush(stdout);
-}
 #else
-static void info(char *fmt,...) {}
-static void info_flush() {}
+static void info(const char *fmt,...) {}
 #endif
 
 //
@@ -564,7 +569,7 @@ void Solver::Solve(int l, const QMatrix&amp; Q, const double *p_, const schar *y_,
 		{
 			counter = min(l,1000);
 			if(shrinking) do_shrinking();
-			info(&quot;.&quot;); info_flush();
+			info(&quot;.&quot;);
 		}
 
 		int i,j;
@@ -574,7 +579,7 @@ void Solver::Solve(int l, const QMatrix&amp; Q, const double *p_, const schar *y_,
 			reconstruct_gradient();
 			// reset active set size and check
 			active_size = l;
-			info(&quot;*&quot;); info_flush();
+			info(&quot;*&quot;);
 			if(select_working_set(i,j)!=0)
 				break;
 			else
@@ -927,7 +932,7 @@ void Solver::do_shrinking()
 		unshrink = true;
 		reconstruct_gradient();
 		active_size = l;
-		info(&quot;*&quot;); info_flush();
+		info(&quot;*&quot;);
 	}
 
 	for(i=0;i&lt;active_size;i++)
@@ -1110,7 +1115,7 @@ int Solver_NU::select_working_set(int &amp;out_i, int &amp;out_j)
 	}
 
 	if(max(Gmaxp+Gmaxp2,Gmaxn+Gmaxn2) &lt; eps)
- 		return 1;
+		return 1;
 
 	if (y[Gmin_idx] == +1)
 		out_i = Gmaxp_idx;
@@ -1388,7 +1393,7 @@ public:
 		Qfloat *buf = buffer[next_buffer];
 		next_buffer = 1 - next_buffer;
 		schar si = sign[i];
-		for(int j=0;j&lt;len;j++)
+		for(j=0;j&lt;len;j++)
 			buf[j] = (Qfloat) si * (Qfloat) sign[j] * data[index[j]];
 		return buf;
 	}
@@ -1625,7 +1630,6 @@ struct decision_function
 {
 	double *alpha;
 	double rho;	
-    double obj;
 };
 
 decision_function svm_train_one(
@@ -1682,7 +1686,6 @@ decision_function svm_train_one(
 	decision_function f;
 	f.alpha = alpha;
 	f.rho = si.rho;
-	f.obj = si.obj;
 	return f;
 }
 
@@ -1697,11 +1700,9 @@ struct svm_model
 	svm_node **SV;		// SVs (SV[l])
 	double **sv_coef;	// coefficients for SVs in decision functions (sv_coef[k-1][l])
 	double *rho;		// constants in decision functions (rho[k*(k-1)/2])
-	double *probA;          // pariwise probability information
+	double *probA;		// pariwise probability information
 	double *probB;
 
-	double *obj;
-
 	// for classification only
 
 	int *label;		// label of each class (label[k])
@@ -1712,48 +1713,6 @@ struct svm_model
 				// 0 if svm_model is created by svm_train
 };
 
-// Get the rho element of the model. Only works when there are two
-// labels (1 classifier).
-double svm_get_model_rho(struct svm_model *model)
-{
-  if (model-&gt;nr_class &gt; 2)
-    info(&quot;warning: rho requested for model with more than 2 labels&quot;);
-  return model-&gt;rho[0];
-}
-
-int svm_get_model_num_coefs(struct svm_model *model)
-{
-  return model-&gt;l;
-}
-
-// Get the coefficients of the model. Only works when there are two
-// labels (1 classifier).
-void svm_get_model_coefs(struct svm_model *model, double* out_array)
-{
-  if (model-&gt;nr_class &gt; 2)
-    info(&quot;warning: coefficients requested for model with more than 2 labels&quot;);
-  memcpy(out_array, model-&gt;sv_coef[0], sizeof(double) * model-&gt;l);
-}
-
-// Get the permutation of the indices of the coefficients w.r.t. to the input problem.
-void svm_get_model_perm(struct svm_model *model, int* out_array)
-{
-  if (model-&gt;nr_class &gt; 2)
-    info(&quot;warning: permutation requested for model with more than 2 labels&quot;);
-  int i;
-  for ( i = 0; i &lt; model-&gt;l; ++i)
-  {
-    struct svm_node* n = model-&gt;SV[i];
-    if (0 != n-&gt;index)
-    {
-      info(&quot;warning: missing 0 index&quot;);
-      out_array[i] = -1;
-    }
-    else
-      out_array[i] = (int)n-&gt;value;
-  }
-}
-
 // Platt's binary SVM Probablistic Output: an improvement from Lin et al.
 void sigmoid_train(
 	int l, const double *dec_values, const double *labels, 
@@ -1766,7 +1725,7 @@ void sigmoid_train(
 		if (labels[i] &gt; 0) prior1+=1;
 		else prior0+=1;
 	
-	int max_iter=100; 	// Maximal number of iterations
+	int max_iter=100;	// Maximal number of iterations
 	double min_step=1e-10;	// Minimal step taken in line search
 	double sigma=1e-12;	// For numerically strict PD of Hessian
 	double eps=1e-5;
@@ -1830,7 +1789,7 @@ void sigmoid_train(
 		gd=g1*dA+g2*dB;
 
 
-		stepsize = 1; 		// Line Search
+		stepsize = 1;		// Line Search
 		while (stepsize &gt;= min_step)
 		{
 			newA = A + stepsize * dA;
@@ -2050,10 +2009,10 @@ double svm_svr_probability(
 	int count=0;
 	mae=0;
 	for(i=0;i&lt;prob-&gt;l;i++)
-	        if (fabs(ymv[i]) &gt; 5*std) 
-                        count=count+1;
+		if (fabs(ymv[i]) &gt; 5*std) 
+			count=count+1;
 		else 
-		        mae+=fabs(ymv[i]);
+			mae+=fabs(ymv[i]);
 	mae /= (prob-&gt;l-count);
 	info(&quot;Prob. model for test data: target value = predicted value + z,\nz: Laplace distribution e^(-|z|/sigma)/(2sigma),sigma= %g\n&quot;,mae);
 	free(ymv);
@@ -2151,8 +2110,6 @@ svm_model *svm_train(const svm_problem *prob, const svm_parameter *param)
 		decision_function f = svm_train_one(prob,param,0,0);
 		model-&gt;rho = Malloc(double,1);
 		model-&gt;rho[0] = f.rho;
-		model-&gt;obj = Malloc(double,1);
-		model-&gt;obj[0] = f.obj;
 
 		int nSV = 0;
 		int i;
@@ -2266,13 +2223,8 @@ svm_model *svm_train(const svm_problem *prob, const svm_parameter *param)
 			model-&gt;label[i] = label[i];
 		
 		model-&gt;rho = Malloc(double,nr_class*(nr_class-1)/2);
-		model-&gt;obj = Malloc(double,nr_class*(nr_class-1)/2);
 		for(i=0;i&lt;nr_class*(nr_class-1)/2;i++)
-		  {
 			model-&gt;rho[i] = f[i].rho;
-		    model-&gt;obj[i] = f[i].obj;
-		  }
-
 
 		if(param-&gt;probability)
 		{
@@ -2482,10 +2434,6 @@ void svm_cross_validation(const svm_problem *prob, const svm_parameter *param, i
 	free(perm);	
 }
 
-double svm_get_obj(const svm_model *model, const int i)
-{
-	return model-&gt;obj[i];
-}
 
 int svm_get_svm_type(const svm_model *model)
 {
@@ -2511,7 +2459,7 @@ double svm_get_svr_probability(const svm_model *model)
 		return model-&gt;probA[0];
 	else
 	{
-		info(&quot;Model doesn't contain information for SVR probability inference\n&quot;);
+		fprintf(stderr,&quot;Model doesn't contain information for SVR probability inference\n&quot;);
 		return 0;
 	}
 }
@@ -2647,7 +2595,7 @@ double svm_predict_probability(
 		for(i=0;i&lt;nr_class;i++)
 			free(pairwise_prob[i]);
 		free(dec_values);
-                free(pairwise_prob);	     
+		free(pairwise_prob);	     
 		return model-&gt;label[prob_max_idx];
 	}
 	else 
@@ -2751,6 +2699,27 @@ int svm_save_model(const char *model_file_name, const svm_model *model)
 	else return 0;
 }
 
+static char *line = NULL;
+static int max_line_len;
+
+static char* readline(FILE *input)
+{
+	int len;
+
+	if(fgets(line,max_line_len,input) == NULL)
+		return NULL;
+
+	while(strrchr(line,'\n') == NULL)
+	{
+		max_line_len *= 2;
+		line = (char *) realloc(line,max_line_len);
+		len = (int) strlen(line);
+		if(fgets(line+len,max_line_len-len,input) == NULL)
+			break;
+	}
+	return line;
+}
+
 svm_model *svm_load_model(const char *model_file_name)
 {
 	FILE *fp = fopen(model_file_name,&quot;rb&quot;);
@@ -2766,8 +2735,6 @@ svm_model *svm_load_model(const char *model_file_name)
 	model-&gt;label = NULL;
 	model-&gt;nSV = NULL;
 
-	model-&gt;obj = NULL;
-
 	char cmd[81];
 	while(1)
 	{
@@ -2789,7 +2756,6 @@ svm_model *svm_load_model(const char *model_file_name)
 			{
 				fprintf(stderr,&quot;unknown svm type.\n&quot;);
 				free(model-&gt;rho);
-				free(model-&gt;obj);
 				free(model-&gt;label);
 				free(model-&gt;nSV);
 				free(model);
@@ -2812,7 +2778,6 @@ svm_model *svm_load_model(const char *model_file_name)
 			{
 				fprintf(stderr,&quot;unknown kernel function.\n&quot;);
 				free(model-&gt;rho);
-				free(model-&gt;obj);
 				free(model-&gt;label);
 				free(model-&gt;nSV);
 				free(model);
@@ -2877,7 +2842,6 @@ svm_model *svm_load_model(const char *model_file_name)
 		{
 			fprintf(stderr,&quot;unknown text in model file: [%s]\n&quot;,cmd);
 			free(model-&gt;rho);
-			free(model-&gt;obj);
 			free(model-&gt;label);
 			free(model-&gt;nSV);
 			free(model);
@@ -2890,23 +2854,23 @@ svm_model *svm_load_model(const char *model_file_name)
 	int elements = 0;
 	long pos = ftell(fp);
 
-	while(1)
+	max_line_len = 1024;
+	line = Malloc(char,max_line_len);
+	char *p,*endptr,*idx,*val;
+
+	while(readline(fp)!=NULL)
 	{
-		int c = fgetc(fp);
-		switch(c)
+		p = strtok(line,&quot;:&quot;);
+		while(1)
 		{
-			case '\n':
-				// count the '-1' element
-			case ':':
-				++elements;
+			p = strtok(NULL,&quot;:&quot;);
+			if(p == NULL)
 				break;
-			case EOF:
-				goto out;
-			default:
-				;
+			++elements;
 		}
 	}
-out:
+	elements += model-&gt;l;
+
 	fseek(fp,pos,SEEK_SET);
 
 	int m = model-&gt;nr_class - 1;
@@ -2916,30 +2880,41 @@ out:
 	for(i=0;i&lt;m;i++)
 		model-&gt;sv_coef[i] = Malloc(double,l);
 	model-&gt;SV = Malloc(svm_node*,l);
-	svm_node *x_space=NULL;
+	svm_node *x_space = NULL;
 	if(l&gt;0) x_space = Malloc(svm_node,elements);
 
 	int j=0;
 	for(i=0;i&lt;l;i++)
 	{
+		readline(fp);
 		model-&gt;SV[i] = &amp;x_space[j];
-		for(int k=0;k&lt;m;k++)
-			fscanf(fp,&quot;%lf&quot;,&amp;model-&gt;sv_coef[k][i]);
+
+		p = strtok(line, &quot; \t&quot;);
+		model-&gt;sv_coef[0][i] = strtod(p,&amp;endptr);
+		for(int k=1;k&lt;m;k++)
+		{
+			p = strtok(NULL, &quot; \t&quot;);
+			model-&gt;sv_coef[k][i] = strtod(p,&amp;endptr);
+		}
+
 		while(1)
 		{
-			int c;
-			do {
-				c = getc(fp);
-				if(c=='\n') goto out2;
-			} while(isspace(c));
-			ungetc(c,fp);
-			fscanf(fp,&quot;%d:%lf&quot;,&amp;(x_space[j].index),&amp;(x_space[j].value));
+			idx = strtok(NULL, &quot;:&quot;);
+			val = strtok(NULL, &quot; \t&quot;);
+
+			if(val == NULL)
+				break;
+			x_space[j].index = (int) strtol(idx,&amp;endptr,10);
+			x_space[j].value = strtod(val,&amp;endptr);
+
 			++j;
-		}	
-out2:
+		}
 		x_space[j++].index = -1;
 	}
-	if (ferror(fp) != 0 || fclose(fp) != 0) return NULL;
+	free(line);
+
+	if (ferror(fp) != 0 || fclose(fp) != 0)
+		return NULL;
 
 	model-&gt;free_sv = 1;	// XXX
 	return model;
@@ -2954,7 +2929,6 @@ void svm_destroy_model(svm_model* model)
 	free(model-&gt;SV);
 	free(model-&gt;sv_coef);
 	free(model-&gt;rho);
-	free(model-&gt;obj);
 	free(model-&gt;label);
 	free(model-&gt;probA);
 	free(model-&gt;probB);</diff>
      <filename>ext/svm.cpp</filename>
    </modified>
    <modified>
      <diff>@@ -1,12 +1,14 @@
 #ifndef _LIBSVM_H
 #define _LIBSVM_H
 
-#define LIBSVM_VERSION 288
+#define LIBSVM_VERSION 289
 
 #ifdef __cplusplus
 extern &quot;C&quot; {
 #endif
 
+extern int libsvm_version;
+
 struct svm_node
 {
 	int index;
@@ -50,8 +52,6 @@ void svm_cross_validation(const struct svm_problem *prob, const struct svm_param
 int svm_save_model(const char *model_file_name, const struct svm_model *model);
 struct svm_model *svm_load_model(const char *model_file_name);
 
-double svm_get_obj(const struct svm_model *model, const int i);
-
 int svm_get_svm_type(const struct svm_model *model);
 int svm_get_nr_class(const struct svm_model *model);
 void svm_get_labels(const struct svm_model *model, int *label);
@@ -67,12 +67,7 @@ void svm_destroy_param(struct svm_parameter *param);
 const char *svm_check_parameter(const struct svm_problem *prob, const struct svm_parameter *param);
 int svm_check_probability_model(const struct svm_model *model);
 
-double  svm_get_model_rho(struct svm_model *model);
-int     svm_get_model_num_coefs(struct svm_model *model);
-// out_array must have svm_get_model_num_coefs(model) elements
-void    svm_get_model_coefs(struct svm_model *model, double* out_array);
-// out_array must have svm_get_model_num_coef(model)s elements
-void    svm_get_model_perm(struct svm_model *model, int* out_array);
+extern void (*svm_print_string) (const char *);
 
 #ifdef __cplusplus
 }</diff>
      <filename>ext/svm.h</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>5b3ec457c1aaa866b8d7890a37e8c4f36e7f4803</id>
    </parent>
  </parents>
  <author>
    <name>dev</name>
    <email>tom.z.zeng@gmail.com</email>
  </author>
  <url>http://github.com/tomz/libsvm-ruby-swig/commit/a88656c16fb178bc867e4611b0ae2bc7c36394df</url>
  <id>a88656c16fb178bc867e4611b0ae2bc7c36394df</id>
  <committed-date>2009-05-15T13:46:20-07:00</committed-date>
  <authored-date>2009-05-15T13:46:20-07:00</authored-date>
  <message>Sync with LIBSVM 2.89 files</message>
  <tree>c36e7857fb9cf9fc5e999720f63c22ae212366f2</tree>
  <committer>
    <name>dev</name>
    <email>tom.z.zeng@gmail.com</email>
  </committer>
</commit>
