[Cogl] [PATCH 1/2] Remove the cogl_foo_init_from_foo copy constructors

Robert Bragg robert at sixbynine.org
Fri Oct 19 14:34:39 PDT 2012


This two patches look good to land to me:

Reviewed-by: Robert Bragg <robert at linux.intel.com>

thanks,
- Robert

On Fri, Oct 19, 2012 at 5:24 PM, Neil Roberts <neil at linux.intel.com> wrote:
> The CoglQuaternion type is allocated by the caller and can not have
> any additional resources so it should be obvious that you can just use
> the regular assignment operator to copy them. None of the other types
> except the commented out vec4 type have a copy constructor so we
> might as well remove these too.
> ---
>  cogl/cogl-quaternion.c                 |  7 -------
>  cogl/cogl-quaternion.h                 | 11 -----------
>  cogl/cogl-vector.c                     |  6 ------
>  doc/reference/cogl2/cogl2-sections.txt |  1 -
>  4 files changed, 25 deletions(-)
>
> diff --git a/cogl/cogl-quaternion.c b/cogl/cogl-quaternion.c
> index 70cfe3e..eac9d94 100644
> --- a/cogl/cogl-quaternion.c
> +++ b/cogl/cogl-quaternion.c
> @@ -226,13 +226,6 @@ cogl_quaternion_init_from_euler (CoglQuaternion *quaternion,
>      sin_heading * sin_pitch * cos_roll;
>  }
>
> -void
> -cogl_quaternion_init_from_quaternion (CoglQuaternion *quaternion,
> -                                      CoglQuaternion *src)
> -{
> -  memcpy (quaternion, src, sizeof (float) * 4);
> -}
> -
>  /* XXX: it could be nice to make something like this public... */
>  /*
>   * COGL_MATRIX_READ:
> diff --git a/cogl/cogl-quaternion.h b/cogl/cogl-quaternion.h
> index a1b3cfb..8daf95d 100644
> --- a/cogl/cogl-quaternion.h
> +++ b/cogl/cogl-quaternion.h
> @@ -260,17 +260,6 @@ cogl_quaternion_init_from_euler (CoglQuaternion *quaternion,
>                                   const CoglEuler *euler);
>
>  /**
> - * cogl_quaternion_init_from_quaternion:
> - * @quaternion: A #CoglQuaternion
> - * @src: A #CoglQuaternion with which to initialize @quaternion
> - *
> - * Since: 2.0
> - */
> -void
> -cogl_quaternion_init_from_quaternion (CoglQuaternion *quaternion,
> -                                      CoglQuaternion *src);
> -
> -/**
>   * cogl_quaternion_init_from_matrix:
>   * @quaternion: A Cogl Quaternion
>   * @matrix: A rotation matrix with which to initialize the quaternion
> diff --git a/cogl/cogl-vector.c b/cogl/cogl-vector.c
> index 7984db4..8015266 100644
> --- a/cogl/cogl-vector.c
> +++ b/cogl/cogl-vector.c
> @@ -221,12 +221,6 @@ cogl_vector4_init_zero (float *vector)
>    memset (vector, 0, sizeof (CoglVector4));
>  }
>
> -void
> -cogl_vector4_init_from_vector4 (float *vector, float *src)
> -{
> -  *vector4 = *src;
> -}
> -
>  CoglBool
>  cogl_vector4_equal (const void *v0, const void *v1)
>  {
> diff --git a/doc/reference/cogl2/cogl2-sections.txt b/doc/reference/cogl2/cogl2-sections.txt
> index c02b87b..ba43264 100644
> --- a/doc/reference/cogl2/cogl2-sections.txt
> +++ b/doc/reference/cogl2/cogl2-sections.txt
> @@ -550,7 +550,6 @@ cogl_euler_free
>  CoglQuaternion
>  cogl_quaternion_init_identity
>  cogl_quaternion_init
> -cogl_quaternion_init_from_quaternion
>  cogl_quaternion_init_from_angle_vector
>  cogl_quaternion_init_from_array
>  cogl_quaternion_init_from_x_rotation
> --
> 1.7.11.3.g3c3efa5
>
> _______________________________________________
> Cogl mailing list
> Cogl at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/cogl


More information about the Cogl mailing list